Commit bde4a4f817aa26f57e6c6d21e7b67339a33f7996

Authored by Larissa Reis
1 parent 15f77ee3

profile followers: Fixes failing test

We now remove profile_follewers if its circle is deleted
Showing 1 changed file with 3 additions and 7 deletions   Show diff stats
test/functional/circles_controller_test.rb
@@ -74,17 +74,13 @@ class CirclesControllerTest < ActionController::TestCase @@ -74,17 +74,13 @@ class CirclesControllerTest < ActionController::TestCase
74 assert_response 404 74 assert_response 404
75 end 75 end
76 76
77 - should 'destroy an existing circle and update related profiles' do 77 + should 'destroy an existing circle and remove related profiles' do
78 circle = Circle.create!(:name => "circle", :person => @person, :profile_type => 'Person') 78 circle = Circle.create!(:name => "circle", :person => @person, :profile_type => 'Person')
79 - follower = fast_create(ProfileFollower, :profile_id => fast_create(Person).id,  
80 - :circle_id => circle.id) 79 + fast_create(ProfileFollower, :profile_id => fast_create(Person).id, :circle_id => circle.id)
81 80
82 - assert_difference "@person.circles.count", -1 do 81 + assert_difference ["@person.circles.count", 'ProfileFollower.count'], -1 do
83 post :destroy, :profile => @person.identifier, :id => circle.id 82 post :destroy, :profile => @person.identifier, :id => circle.id
84 end 83 end
85 -  
86 - follower.reload  
87 - assert_nil follower.circle  
88 end 84 end
89 85
90 should 'not destroy an existing circle if action is not post' do 86 should 'not destroy an existing circle if action is not post' do