Skip to content

Commit

Permalink
add example 'when Rails::VERSION::MAJOR < 7'
Browse files Browse the repository at this point in the history
  • Loading branch information
atolix committed May 9, 2024
1 parent 8ebe075 commit 7a494fc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions spec/controllers/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,18 @@
allow_any_instance_of(ActionController::TestRequest).to receive(:referer).and_return('http://test.host/referer_action')
end

it 'uses Rails 7 redirect_back_or_to method' do
get :test_return_to
context 'when Rails::VERSION::MAJOR >= 7', skip: Rails::VERSION::MAJOR < 7 do
it 'uses Rails 7 redirect_back_or_to method' do
get :test_return_to

expect(response).to redirect_to('http://test.host/referer_action')
end
end

expect(response).to redirect_to('http://test.host/referer_action')
context 'when Rails::VERSION::MAJOR < 7', skip: Rails::VERSION::MAJOR >= 7 do
it 'raise NoMethodError' do
expect { get :test_return_to }.to raise_error(NoMethodError)
end
end
end

Expand Down

0 comments on commit 7a494fc

Please sign in to comment.