Skip to content

Commit

Permalink
Introduces HTTP_REFERER support
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Sep 27, 2023
1 parent 97e14d8 commit a94f128
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/spec/rails_helper.rb
Expand Up @@ -85,3 +85,6 @@

# support time helpers
require 'support/time_helpers'

# support HTTP_REFERER
require 'support/redirect_back'
18 changes: 18 additions & 0 deletions src/api/spec/support/redirect_back.rb
@@ -0,0 +1,18 @@
module RedirectBack
# Usage in specs:
#
# describe 'POST #create' do
# it 'redirects back' do
# from about_path
# post :create, params: { thing: @thing }
# expect(response).to redirect_to about_url
# end
# end
def from(url)
request.env['HTTP_REFERER'] = url
end
end

RSpec.configure do |config|
config.include RedirectBack
end

0 comments on commit a94f128

Please sign in to comment.