-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97e14d8
commit a94f128
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,3 +85,6 @@ | |
|
||
# support time helpers | ||
require 'support/time_helpers' | ||
|
||
# support HTTP_REFERER | ||
require 'support/redirect_back' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |