-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #454 from alphagov/really-fix-422-errors
Add tests for #453
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 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
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
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,31 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'session cookie', type: :request, show_exceptions: true do | ||
let(:date) { Time.utc(2016, 4, 12, 12, 59, 59) } | ||
let(:cookies) { response.header["Set-Cookie"].split("\n") } | ||
|
||
subject do | ||
cookies.find{ |c| c =~ /^_epets_session/ } | ||
end | ||
|
||
before do | ||
petition = FactoryGirl.create(:open_petition) | ||
get "/petitions/#{petition.id}/signatures/new" | ||
end | ||
|
||
around do |example| | ||
travel_to(date) { example.run } | ||
end | ||
|
||
it "should set the secure option" do | ||
expect(subject).to match(/; secure/i) | ||
end | ||
|
||
it "should set the httponly option" do | ||
expect(subject).to match(/; httponly/i) | ||
end | ||
|
||
it "should set the expiry to 2 weeks from now" do | ||
expect(subject).to match(/; expires=Tue, 26 Apr 2016 12:59:59 -0000/) | ||
end | ||
end |