Commit 03614d52e3d3042ca61da09b66dc6f09de47bcd6

Authored by Antonio Terceiro
1 parent 70359d29

fix functional tests that fail without notification emails

Showing 1 changed file with 16 additions and 16 deletions   Show diff stats
test/functional/profile_controller_test.rb
@@ -78,7 +78,7 @@ class ProfileControllerTest < ActionController::TestCase @@ -78,7 +78,7 @@ class ProfileControllerTest < ActionController::TestCase
78 78
79 should 'actually add friend' do 79 should 'actually add friend' do
80 login_as(@profile.identifier) 80 login_as(@profile.identifier)
81 - person = fast_create(Person) 81 + person = create_user.person
82 assert_difference 'AddFriend.count' do 82 assert_difference 'AddFriend.count' do
83 post :add, :profile => person.identifier 83 post :add, :profile => person.identifier
84 end 84 end
@@ -366,10 +366,10 @@ class ProfileControllerTest < ActionController::TestCase @@ -366,10 +366,10 @@ class ProfileControllerTest < ActionController::TestCase
366 assert profile.memberships.include?(community), 'profile should be actually added to the community' 366 assert profile.memberships.include?(community), 'profile should be actually added to the community'
367 end 367 end
368 368
369 - should 'create task when join to closed organization with members' do 369 + should 'create a task when joining a closed organization with members' do
370 community = fast_create(Community) 370 community = fast_create(Community)
371 community.update_attribute(:closed, true) 371 community.update_attribute(:closed, true)
372 - admin = fast_create(Person) 372 + admin = create_user.person
373 community.add_member(admin) 373 community.add_member(admin)
374 374
375 login_as profile.identifier 375 login_as profile.identifier
@@ -587,7 +587,7 @@ class ProfileControllerTest < ActionController::TestCase @@ -587,7 +587,7 @@ class ProfileControllerTest < ActionController::TestCase
587 should "leave a scrap on another profile" do 587 should "leave a scrap on another profile" do
588 login_as(profile.identifier) 588 login_as(profile.identifier)
589 count = Scrap.count 589 count = Scrap.count
590 - another_person = fast_create(Person) 590 + another_person = create_user.person
591 assert another_person.scraps_received.empty? 591 assert another_person.scraps_received.empty?
592 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} 592 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'}
593 assert_equal count + 1, Scrap.count 593 assert_equal count + 1, Scrap.count
@@ -645,7 +645,7 @@ class ProfileControllerTest < ActionController::TestCase @@ -645,7 +645,7 @@ class ProfileControllerTest < ActionController::TestCase
645 should "the sender be the logged user by default" do 645 should "the sender be the logged user by default" do
646 login_as(profile.identifier) 646 login_as(profile.identifier)
647 count = Scrap.count 647 count = Scrap.count
648 - another_person = fast_create(Person) 648 + another_person = create_user.person
649 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} 649 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'}
650 last = Scrap.last 650 last = Scrap.last
651 assert_equal profile, last.sender 651 assert_equal profile, last.sender
@@ -654,7 +654,7 @@ class ProfileControllerTest < ActionController::TestCase @@ -654,7 +654,7 @@ class ProfileControllerTest < ActionController::TestCase
654 should "the receiver be the current profile by default" do 654 should "the receiver be the current profile by default" do
655 login_as(profile.identifier) 655 login_as(profile.identifier)
656 count = Scrap.count 656 count = Scrap.count
657 - another_person = fast_create(Person) 657 + another_person = create_user.person
658 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'} 658 post :leave_scrap, :profile => another_person.identifier, :scrap => {:content => 'something'}
659 last = Scrap.last 659 last = Scrap.last
660 assert_equal another_person, last.receiver 660 assert_equal another_person, last.receiver
@@ -686,8 +686,8 @@ class ProfileControllerTest < ActionController::TestCase @@ -686,8 +686,8 @@ class ProfileControllerTest < ActionController::TestCase
686 end 686 end
687 687
688 should 'not display activities of the current profile when he is not followed by the viewer' do 688 should 'not display activities of the current profile when he is not followed by the viewer' do
689 - p1= fast_create(Person)  
690 - p2= fast_create(Person) 689 + p1= create_user.person
  690 + p2= create_user.person
691 691
692 UserStampSweeper.any_instance.stubs(:current_user).returns(p1) 692 UserStampSweeper.any_instance.stubs(:current_user).returns(p1)
693 scrap1 = create(Scrap, defaults_for_scrap(:sender => p1, :receiver => p2)) 693 scrap1 = create(Scrap, defaults_for_scrap(:sender => p1, :receiver => p2))
@@ -714,9 +714,9 @@ class ProfileControllerTest < ActionController::TestCase @@ -714,9 +714,9 @@ class ProfileControllerTest < ActionController::TestCase
714 end 714 end
715 715
716 should 'not see the friends activities in the current profile' do 716 should 'not see the friends activities in the current profile' do
717 - p2= fast_create(Person) 717 + p2 = create_user.person
718 assert !profile.is_a_friend?(p2) 718 assert !profile.is_a_friend?(p2)
719 - p3= fast_create(Person) 719 + p3 = create_user.person
720 p3.add_friend(profile) 720 p3.add_friend(profile)
721 assert p3.is_a_friend?(profile) 721 assert p3.is_a_friend?(profile)
722 ActionTracker::Record.destroy_all 722 ActionTracker::Record.destroy_all
@@ -810,10 +810,10 @@ class ProfileControllerTest < ActionController::TestCase @@ -810,10 +810,10 @@ class ProfileControllerTest < ActionController::TestCase
810 end 810 end
811 811
812 should 'the network activity be visible only to logged users' do 812 should 'the network activity be visible only to logged users' do
813 - p1= fast_create(Person)  
814 - p2= fast_create(Person) 813 + p1= create_user.person
  814 + p2= create_user.person
815 assert !p1.is_a_friend?(p2) 815 assert !p1.is_a_friend?(p2)
816 - p3= fast_create(Person) 816 + p3= create_user.person
817 p3.add_friend(p1) 817 p3.add_friend(p1)
818 assert p3.is_a_friend?(p1) 818 assert p3.is_a_friend?(p1)
819 ActionTracker::Record.destroy_all 819 ActionTracker::Record.destroy_all
@@ -872,10 +872,10 @@ class ProfileControllerTest < ActionController::TestCase @@ -872,10 +872,10 @@ class ProfileControllerTest < ActionController::TestCase
872 end 872 end
873 873
874 should 'the self activity not crashes with user not logged in' do 874 should 'the self activity not crashes with user not logged in' do
875 - p1= fast_create(Person)  
876 - p2= fast_create(Person) 875 + p1= create_user.person
  876 + p2= create_user.person
877 assert !p1.is_a_friend?(p2) 877 assert !p1.is_a_friend?(p2)
878 - p3= fast_create(Person) 878 + p3= create_user.person
879 p3.add_friend(p1) 879 p3.add_friend(p1)
880 assert p3.is_a_friend?(p1) 880 assert p3.is_a_friend?(p1)
881 ActionTracker::Record.destroy_all 881 ActionTracker::Record.destroy_all