Commit db6b43ef48539509db0095b7af252a1e4baadd98
Committed by
David Silva
1 parent
5b3ded01
Exists in
master
and in
5 other branches
Fix broken functional tests
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Showing
2 changed files
with
15 additions
and
13 deletions
Show diff stats
lib/mpog_software_plugin.rb
... | ... | @@ -143,7 +143,6 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
143 | 143 | !context.session[:hide_incomplete_percentage].blank? |
144 | 144 | |
145 | 145 | person = Person.where(:user_id => context.session[:user]).first |
146 | - puts "="*80,person,"="*80 | |
147 | 146 | call_percentage_profile_template(person) |
148 | 147 | end |
149 | 148 | |
... | ... | @@ -283,7 +282,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
283 | 282 | end |
284 | 283 | end |
285 | 284 | |
286 | - manage_user_institutions(user, leave_communities, enter_communities) | |
285 | + manage_user_institutions(user, old_communities, new_communities) | |
287 | 286 | end |
288 | 287 | |
289 | 288 | def show_sisp_field |
... | ... | @@ -362,7 +361,7 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
362 | 361 | } |
363 | 362 | end |
364 | 363 | |
365 | - def manage_user_institutions(leave_communities, enter_communities) | |
364 | + def manage_user_institutions(user, old_communities, new_communities) | |
366 | 365 | leave_communities = (old_communities - new_communities) |
367 | 366 | enter_communities = (new_communities - old_communities) |
368 | 367 | ... | ... |
test/functional/profile_editor_controller_test.rb
... | ... | @@ -60,11 +60,7 @@ class ProfileEditorControllerTest < ActionController::TestCase |
60 | 60 | end |
61 | 61 | |
62 | 62 | should "add new institution for user into edit profile" do |
63 | - user = fast_create(User) | |
64 | - user.person = fast_create(Person) | |
65 | - user.person.user = user | |
66 | - user.save! | |
67 | - user.person.save! | |
63 | + user = create_basic_user | |
68 | 64 | |
69 | 65 | params_user = Hash.new |
70 | 66 | params_user[:institution_ids] = [] |
... | ... | @@ -79,16 +75,12 @@ class ProfileEditorControllerTest < ActionController::TestCase |
79 | 75 | end |
80 | 76 | |
81 | 77 | should "remove institutions for user into edit profile" do |
82 | - user = fast_create(User) | |
83 | - user.person = fast_create(Person) | |
78 | + user = create_basic_user | |
84 | 79 | |
85 | 80 | @institution_list.each do |institution| |
86 | 81 | user.institutions << institution |
87 | 82 | end |
88 | - | |
89 | - user.person.user = user | |
90 | 83 | user.save! |
91 | - user.person.save! | |
92 | 84 | |
93 | 85 | params_user = Hash.new |
94 | 86 | params_user[:institution_ids] = [] |
... | ... | @@ -99,4 +91,15 @@ class ProfileEditorControllerTest < ActionController::TestCase |
99 | 91 | |
100 | 92 | assert_equal 0, User.last.institutions.count |
101 | 93 | end |
94 | + | |
95 | + protected | |
96 | + | |
97 | + def create_basic_user | |
98 | + user = fast_create(User) | |
99 | + user.person = fast_create(Person) | |
100 | + user.person.user = user | |
101 | + user.save! | |
102 | + user.person.save! | |
103 | + user | |
104 | + end | |
102 | 105 | end | ... | ... |