-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support regex header matching via expect_header_matches
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'spec_helper' | ||
|
||
describe 'expect header matches' do | ||
it 'should ensure partial header match exists' do | ||
mock_get('simple_get', 'Content-Type' => 'application/json') | ||
get '/simple_get' | ||
expect_header_matches(:content_type, /json/) | ||
end | ||
|
||
it 'should ensure header is present' do | ||
mock_get('simple_get', 'Content-Type' => 'application/json') | ||
get '/simple_get' | ||
expect { expect_header_matches(:foo, /json/) }.to raise_error | ||
end | ||
|
||
it 'should ensure partial header is present' do | ||
mock_get('simple_get', 'Content-Type' => 'application/json') | ||
get '/simple_get' | ||
expect { expect_header_matches(:content_type, /bar/) }.to raise_error | ||
end | ||
end |