Commit 083440f474c582d4ead8440bf25a6b2ecb38c286
1 parent
83230b3b
Exists in
master
and in
29 other branches
ActionItem628: adapting tests to refactoring
Showing
4 changed files
with
13 additions
and
18 deletions
Show diff stats
test/functional/tasks_controller_test.rb
... | ... | @@ -64,7 +64,7 @@ class TasksControllerTest < Test::Unit::TestCase |
64 | 64 | end |
65 | 65 | |
66 | 66 | should 'affiliate roles to user after finish add member task' do |
67 | - t = AddMember.create!(:person => profile, :community => profile) | |
67 | + t = AddMember.create!(:person => profile, :organization => profile) | |
68 | 68 | count = profile.members.size |
69 | 69 | post :close, :decision => 'finish', :id => t.id |
70 | 70 | profile = Profile.find(@profile.id) |
... | ... | @@ -72,7 +72,7 @@ class TasksControllerTest < Test::Unit::TestCase |
72 | 72 | end |
73 | 73 | |
74 | 74 | should 'display custom form to add members task' do |
75 | - t = AddMember.create!(:person => profile, :community => profile) | |
75 | + t = AddMember.create!(:person => profile, :organization => profile) | |
76 | 76 | get :index, :profile => profile.identifier |
77 | 77 | assert_tag :tag => 'form', :attributes => { :action => "/myprofile/#{profile.identifier}/tasks/close/#{t.id}" } |
78 | 78 | end |
... | ... | @@ -80,7 +80,7 @@ class TasksControllerTest < Test::Unit::TestCase |
80 | 80 | should 'display member role checked if target has members' do |
81 | 81 | profile.affiliate(profile, Profile::Roles.admin) |
82 | 82 | assert_equal 1, profile.members.size |
83 | - t = AddMember.create!(:person => profile, :community => profile) | |
83 | + t = AddMember.create!(:person => profile, :organization => profile) | |
84 | 84 | get :index, :profile => profile.identifier |
85 | 85 | assert_tag :tag => 'input', :attributes => { :name => 'task[roles][]', :checked => 'checked', :value => Profile::Roles.member.id } |
86 | 86 | end |
... | ... | @@ -88,7 +88,7 @@ class TasksControllerTest < Test::Unit::TestCase |
88 | 88 | should 'display roles besides role member unchecked if target has members' do |
89 | 89 | profile.affiliate(profile, Profile::Roles.admin) |
90 | 90 | assert_equal 1, profile.members.size |
91 | - t = AddMember.create!(:person => profile, :community => profile) | |
91 | + t = AddMember.create!(:person => profile, :organization => profile) | |
92 | 92 | get :index, :profile => profile.identifier |
93 | 93 | Role.find(:all).select{ |r| r.has_kind?('Profile') and r.id != Profile::Roles.member.id }.each do |i| |
94 | 94 | assert_no_tag :tag => 'input', :attributes => { :name => 'task[roles][]', :checked => 'checked', :value => i.id } |
... | ... | @@ -97,7 +97,7 @@ class TasksControllerTest < Test::Unit::TestCase |
97 | 97 | |
98 | 98 | should 'display all roles checked if target has no members' do |
99 | 99 | assert_equal 0, profile.members.size |
100 | - t = AddMember.create!(:person => profile, :community => profile) | |
100 | + t = AddMember.create!(:person => profile, :organization => profile) | |
101 | 101 | get :index, :profile => profile.identifier |
102 | 102 | Role.find(:all).select{ |r| r.has_kind?('Profile') }.each do |i| |
103 | 103 | assert_tag :tag => 'input', :attributes => { :name => 'task[roles][]', :checked => 'checked', :value => i.id } | ... | ... |
test/unit/add_friend_test.rb
... | ... | @@ -72,7 +72,7 @@ class AddFriendTest < ActiveSupport::TestCase |
72 | 72 | |
73 | 73 | task = AddFriend.create!(:person => p1, :friend => p2) |
74 | 74 | |
75 | - assert_equal 'testuser1 wants to be your friend', task.description | |
75 | + assert_equal 'testuser1 wants to be your friend.', task.description | |
76 | 76 | end |
77 | 77 | |
78 | 78 | should 'has permission to manage friends' do | ... | ... |
test/unit/add_member_test.rb
... | ... | @@ -10,7 +10,7 @@ class AddMemberTest < ActiveSupport::TestCase |
10 | 10 | p = create_user('testuser1').person |
11 | 11 | c = Community.create!(:name => 'closed community', :closed => true) |
12 | 12 | TaskMailer.stubs(:deliver_target_notification) |
13 | - task = AddMember.create!(:person => p, :community => c) | |
13 | + task = AddMember.create!(:person => p, :organization => c) | |
14 | 14 | assert_difference c, :members, [p] do |
15 | 15 | task.finish |
16 | 16 | c.reload |
... | ... | @@ -45,7 +45,7 @@ class AddMemberTest < ActiveSupport::TestCase |
45 | 45 | |
46 | 46 | TaskMailer.expects(:deliver_target_notification).at_least_once |
47 | 47 | |
48 | - task = AddMember.create!(:person => p, :community => c) | |
48 | + task = AddMember.create!(:person => p, :organization => c) | |
49 | 49 | end |
50 | 50 | |
51 | 51 | should 'provide proper description' do |
... | ... | @@ -54,14 +54,9 @@ class AddMemberTest < ActiveSupport::TestCase |
54 | 54 | |
55 | 55 | TaskMailer.stubs(:deliver_target_notification) |
56 | 56 | |
57 | - task = AddMember.create!(:person => p, :community => c) | |
57 | + task = AddMember.create!(:person => p, :organization => c) | |
58 | 58 | |
59 | - assert_equal 'testuser1 wants to be a member', task.description | |
60 | - end | |
61 | - | |
62 | - should 'has community alias to target' do | |
63 | - t = AddMember.new | |
64 | - assert_same t.target, t.community | |
59 | + assert_equal 'testuser1 wants to be a member of "closed community".', task.description | |
65 | 60 | end |
66 | 61 | |
67 | 62 | should 'has permission to manage members' do |
... | ... | @@ -73,7 +68,7 @@ class AddMemberTest < ActiveSupport::TestCase |
73 | 68 | p = create_user('testuser1').person |
74 | 69 | c = Community.create!(:name => 'community_test') |
75 | 70 | TaskMailer.stubs(:deliver_target_notification) |
76 | - task = AddMember.create!(:roles => [1,2,3], :person => p, :community => c) | |
71 | + task = AddMember.create!(:roles => [1,2,3], :person => p, :organization => c) | |
77 | 72 | assert_equal [1,2,3], task.roles |
78 | 73 | end |
79 | 74 | |
... | ... | @@ -83,7 +78,7 @@ class AddMemberTest < ActiveSupport::TestCase |
83 | 78 | |
84 | 79 | roles = [Profile::Roles.member, Profile::Roles.admin] |
85 | 80 | TaskMailer.stubs(:deliver_target_notification) |
86 | - task = AddMember.create!(:roles => roles.map(&:id), :person => p, :community => c) | |
81 | + task = AddMember.create!(:roles => roles.map(&:id), :person => p, :organization => c) | |
87 | 82 | task.finish |
88 | 83 | |
89 | 84 | current_roles = p.find_roles(c).map(&:role) | ... | ... |
test/unit/pending_task_notifier_test.rb
... | ... | @@ -17,7 +17,7 @@ class PendingTaskNotifierTest < Test::Unit::TestCase |
17 | 17 | env = Environment.default |
18 | 18 | p = create_user('maelcum').person |
19 | 19 | response = PendingTaskNotifier.deliver_notification(p) |
20 | - assert_equal "#{env.name} - Pending tasks", response.subject | |
20 | + assert_equal "[#{env.name}] Pending tasks", response.subject | |
21 | 21 | assert_equal p.email, response.to[0] |
22 | 22 | end |
23 | 23 | ... | ... |