Skip to content

Commit

Permalink
Fix code to support older versions of Ruby
Browse files Browse the repository at this point in the history
We still support super old versions, yes, and it doesn't like `ensure`
without a `begin..end` unfortunately.

I plan to remove this support soon, but for now I don't want to stop
supporting it yet.
  • Loading branch information
carlosantoniodasilva committed Oct 11, 2023
1 parent e688b2f commit 3481b9e
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions test/integration/omniauthable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,25 +127,29 @@ def stub_action!(name)
end

test "authorization path via GET when Omniauth allowed_request_methods includes GET" do
original_allowed = OmniAuth.config.allowed_request_methods
OmniAuth.config.allowed_request_methods = [:get, :post]
begin
original_allowed = OmniAuth.config.allowed_request_methods
OmniAuth.config.allowed_request_methods = [:get, :post]

get "/users/auth/facebook"
get "/users/auth/facebook"

assert_response(:redirect)
ensure
OmniAuth.config.allowed_request_methods = original_allowed
assert_response(:redirect)
ensure
OmniAuth.config.allowed_request_methods = original_allowed
end
end

test "authorization path via GET when Omniauth allowed_request_methods doesn't include GET" do
original_allowed = OmniAuth.config.allowed_request_methods
OmniAuth.config.allowed_request_methods = [:post]

assert_raises(ActionController::RoutingError) do
get "/users/auth/facebook"
begin
original_allowed = OmniAuth.config.allowed_request_methods
OmniAuth.config.allowed_request_methods = [:post]

assert_raises(ActionController::RoutingError) do
get "/users/auth/facebook"
end
ensure
OmniAuth.config.allowed_request_methods = original_allowed
end
ensure
OmniAuth.config.allowed_request_methods = original_allowed
end

test "generates a link to authenticate with provider" do
Expand Down

0 comments on commit 3481b9e

Please sign in to comment.