Skip to content

Commit 9dc159e

Browse files
committed
Fix custom spec tests
1 parent 06787b5 commit 9dc159e

1 file changed

Lines changed: 10 additions & 18 deletions

File tree

spec/acceptance/customizing_throttled_response_spec.rb

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,17 @@
1111
end
1212
end
1313

14-
it "can be customized" do
15-
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
16-
17-
assert_equal 200, last_response.status
18-
19-
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
20-
21-
assert_equal 429, last_response.status
22-
14+
it "can be customized with throttled_callback" do
2315
Rack::Attack.throttled_callback = lambda do |_req|
2416
[503, {}, ["Throttled"]]
2517
end
2618

2719
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
2820

21+
assert_equal 200, last_response.status
22+
23+
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
24+
2925
assert_equal 503, last_response.status
3026
assert_equal "Throttled", last_response.body
3127
end
@@ -59,21 +55,17 @@
5955
assert_equal 3, match_data[:count]
6056
end
6157

62-
it "supports old style" do
63-
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
64-
65-
assert_equal 200, last_response.status
66-
67-
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
68-
69-
assert_equal 429, last_response.status
70-
58+
it "can be customized with throttled_response" do
7159
Rack::Attack.throttled_response = lambda do |_req|
7260
[503, {}, ["Throttled"]]
7361
end
7462

7563
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
7664

65+
assert_equal 200, last_response.status
66+
67+
get "/", {}, "REMOTE_ADDR" => "1.2.3.4"
68+
7769
assert_equal 503, last_response.status
7870
assert_equal "Throttled", last_response.body
7971
end

0 commit comments

Comments
 (0)