I have a controller with action:
def new
@team = Team.new
@team.team_links.build
end
And I want to test this action with rspec. (I know it works, because it works as it should in the application, but my specs are failing.) Here is my spec:
it "returns new team with built in team_link" do
get 'new'
team = assigns(:team)
team.should be_new_record
team.team_links.should_not be_empty # HERE IS WHERE IT FAILS
end
Here is the error message:
1) TeamsController GET new returns @team and builds one team_link
Failure/Error: team.team_links.should_not be_empty
expected empty? to return false, got true