Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
santib committed Oct 17, 2023
1 parent 3fcf9cf commit 4a91cd7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/acceptance/blocking_ip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
end

it "succeeds if IP doesn't match" do
get "/", {}, "REMOTE_ADDR" => "5.6.7.8"

assert_equal 200, last_response.status
end

it "succeeds if IP is missing" do
get "/", {}, "REMOTE_ADDR" => ""

assert_equal 200, last_response.status
Expand Down
6 changes: 6 additions & 0 deletions spec/acceptance/safelisting_ip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
end

it "forbids request if blocklist condition is true and safelist is false" do
get "/admin", {}, "REMOTE_ADDR" => "1.2.3.4"

assert_equal 403, last_response.status
end

it "forbids request if blocklist condition is true and safelist is false (missing IP)" do
get "/admin", {}, "REMOTE_ADDR" => ""

assert_equal 403, last_response.status
Expand Down

0 comments on commit 4a91cd7

Please sign in to comment.