Skip to content

Commit 1c9aaa2

Browse files
committed
Utilisation de Redis.new plutôt que de la variable globale $redis dans les tests
1 parent f95bc96 commit 1c9aaa2

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

test/controllers/admin/banners_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Admin::BannersControllerTest < ActionDispatch::IntegrationTest
99

1010
teardown do
1111
# Reset
12-
$redis.del('banners')
12+
Redis.new.del('banners')
1313
end
1414

1515
test 'should list banners' do

test/controllers/moderation/news_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class Moderation::NewsControllerTest < ActionDispatch::IntegrationTest
126126
assert_redirected_to moderation_news_url news(:news)
127127

128128
# Reset
129-
$redis.del('nodes/ppp')
129+
Redis.new.del('nodes/ppp')
130130
end
131131

132132
test 'should get vote' do

test/controllers/moderation/polls_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ class Moderation::PollControllerTest < ActionDispatch::IntegrationTest
7878
assert_redirected_to root_url
7979

8080
# Reset
81-
$redis.del('nodes/ppp')
81+
Redis.new.del('nodes/ppp')
8282
end
8383
end

test/controllers/polls_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class PollsControllerTest < ActionDispatch::IntegrationTest
6767

6868
test 'should vote' do
6969
# Remove eventual existing vote
70-
$redis.del "polls/#{polls(:one).id}/127.0.0.1"
70+
Redis.new.del "polls/#{polls(:one).id}/127.0.0.1"
7171
sign_in accounts :joe
7272

7373
post vote_poll_url polls(:one), position: 0
@@ -80,7 +80,7 @@ class PollsControllerTest < ActionDispatch::IntegrationTest
8080

8181
test 'should not vote' do
8282
# Remove eventual existing vote
83-
$redis.del "polls/#{polls(:one).id}/127.0.0.1"
83+
Redis.new.del "polls/#{polls(:one).id}/127.0.0.1"
8484
sign_in accounts :joe
8585

8686
post vote_poll_url polls(:one)

test/controllers/relevances_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class RelevancesControllerTest < ActionDispatch::IntegrationTest
55

66
test 'should vote for' do
77
sign_in accounts 'visitor_0'
8-
$redis.del "comments/#{comments(:one).id}/votes/for", accounts('visitor_0').id
8+
Redis.new.del "comments/#{comments(:one).id}/votes/for", accounts('visitor_0').id
99

1010
assert_difference 'comments(:one).nb_votes_for' do
1111
post relevance_for_node_comment_url nodes(:tracker_one), comments(:one), format: :json
@@ -18,7 +18,7 @@ class RelevancesControllerTest < ActionDispatch::IntegrationTest
1818

1919
test 'should vote against' do
2020
sign_in accounts 'visitor_2'
21-
$redis.del "comments/#{comments(:one).id}/votes/against", accounts('visitor_2').id
21+
Redis.new.del "comments/#{comments(:one).id}/votes/against", accounts('visitor_2').id
2222

2323
assert_difference 'comments(:one).nb_votes_against' do
2424
post relevance_against_node_comment_url nodes(:tracker_one), comments(:one), format: :json

test/controllers/votes_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class VotesControllerTest < ActionDispatch::IntegrationTest
66
test 'should vote for' do
77
sign_in accounts 'admin_0'
88

9-
$redis.del "nodes/#{nodes(:one).id}/votes/#{accounts('admin_0').id}"
9+
Redis.new.del "nodes/#{nodes(:one).id}/votes/#{accounts('admin_0').id}"
1010
assert_difference 'nodes(:one).score' do
1111
post vote_for_node_url nodes(:one)
1212

@@ -29,7 +29,7 @@ class VotesControllerTest < ActionDispatch::IntegrationTest
2929
test 'should vote against' do
3030
sign_in accounts 'admin_0'
3131

32-
$redis.del "nodes/#{nodes(:one).id}/votes/#{accounts('admin_0').id}"
32+
Redis.new.del "nodes/#{nodes(:one).id}/votes/#{accounts('admin_0').id}"
3333
assert_difference 'nodes(:one).score', -1 do
3434
post vote_against_node_url nodes(:one)
3535

0 commit comments

Comments
 (0)