Commit b555684bbd441b1e28d7c74ca142391dc8633e5a
1 parent
6120369e
Exists in
master
and in
29 other branches
Move duplicated code into a method on its own
(ActionItem1640)
Showing
2 changed files
with
15 additions
and
9 deletions
Show diff stats
test/functional/invite_controller_test.rb
... | ... | @@ -18,7 +18,7 @@ class InviteControllerTest < ActionController::TestCase |
18 | 18 | end |
19 | 19 | |
20 | 20 | assert_difference InviteFriend, :count, 1 do |
21 | - Delayed::Worker.new.work_off | |
21 | + process_delayed_job_queue | |
22 | 22 | end |
23 | 23 | end |
24 | 24 | |
... | ... | @@ -30,7 +30,7 @@ class InviteControllerTest < ActionController::TestCase |
30 | 30 | end |
31 | 31 | |
32 | 32 | assert_difference InviteFriend, :count, 1 do |
33 | - Delayed::Worker.new.work_off | |
33 | + process_delayed_job_queue | |
34 | 34 | end |
35 | 35 | end |
36 | 36 | |
... | ... | @@ -42,7 +42,7 @@ class InviteControllerTest < ActionController::TestCase |
42 | 42 | end |
43 | 43 | |
44 | 44 | assert_difference InviteFriend, :count, 1 do |
45 | - Delayed::Worker.new.work_off | |
45 | + process_delayed_job_queue | |
46 | 46 | end |
47 | 47 | end |
48 | 48 | |
... | ... | @@ -54,7 +54,7 @@ class InviteControllerTest < ActionController::TestCase |
54 | 54 | end |
55 | 55 | |
56 | 56 | assert_difference InviteFriend, :count, 2 do |
57 | - Delayed::Worker.new.work_off | |
57 | + process_delayed_job_queue | |
58 | 58 | end |
59 | 59 | end |
60 | 60 | |
... | ... | @@ -66,7 +66,7 @@ class InviteControllerTest < ActionController::TestCase |
66 | 66 | end |
67 | 67 | |
68 | 68 | assert_difference InviteFriend, :count, 1 do |
69 | - Delayed::Worker.new.work_off | |
69 | + process_delayed_job_queue | |
70 | 70 | end |
71 | 71 | end |
72 | 72 | |
... | ... | @@ -78,7 +78,7 @@ class InviteControllerTest < ActionController::TestCase |
78 | 78 | end |
79 | 79 | |
80 | 80 | assert_no_difference InviteFriend, :count do |
81 | - Delayed::Worker.new.work_off | |
81 | + process_delayed_job_queue | |
82 | 82 | end |
83 | 83 | end |
84 | 84 | |
... | ... | @@ -93,7 +93,7 @@ class InviteControllerTest < ActionController::TestCase |
93 | 93 | end |
94 | 94 | |
95 | 95 | assert_no_difference InviteFriend, :count do |
96 | - Delayed::Worker.new.work_off | |
96 | + process_delayed_job_queue | |
97 | 97 | end |
98 | 98 | end |
99 | 99 | |
... | ... | @@ -164,7 +164,7 @@ class InviteControllerTest < ActionController::TestCase |
164 | 164 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
165 | 165 | |
166 | 166 | assert ContactList.exists?(contact_list.id) |
167 | - Delayed::Worker.new.work_off | |
167 | + process_delayed_job_queue | |
168 | 168 | assert !ContactList.exists?(contact_list.id) |
169 | 169 | end |
170 | 170 | |
... | ... | @@ -173,7 +173,7 @@ class InviteControllerTest < ActionController::TestCase |
173 | 173 | post :select_friends, :profile => profile.identifier, :manual_import_addresses => "#{friend.name} <#{friend.email}>", :import_from => "not_manual", :mail_template => "click: <url>", :contact_list => contact_list.id |
174 | 174 | |
175 | 175 | assert ContactList.exists?(contact_list.id) |
176 | - Delayed::Worker.new.work_off | |
176 | + process_delayed_job_queue | |
177 | 177 | assert !ContactList.exists?(contact_list.id) |
178 | 178 | end |
179 | 179 | ... | ... |
test/test_helper.rb
... | ... | @@ -175,6 +175,12 @@ class Test::Unit::TestCase |
175 | 175 | @request.instance_variable_set('@host', name) |
176 | 176 | end |
177 | 177 | |
178 | + def process_delayed_job_queue | |
179 | + silence_stream(STDOUT) do | |
180 | + Delayed::Worker.new.work_off | |
181 | + end | |
182 | + end | |
183 | + | |
178 | 184 | end |
179 | 185 | |
180 | 186 | module NoosferoTestHelper | ... | ... |