added spec for response header

This commit is contained in:
shogo-ohta 2011-08-26 23:10:20 +09:00
parent c28e9a177c
commit 9c195af89c
1 changed files with 14 additions and 2 deletions

View File

@ -80,7 +80,7 @@ describe Capybara::Session do
end
end
context "status code" do
context "response headers with status code" do
before(:all) do
@app = lambda do |env|
params = ::Rack::Utils.parse_query(env['QUERY_STRING'])
@ -96,7 +96,7 @@ describe Capybara::Session do
</html>
HTML
[200,
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s, 'X-Capybara' => 'WebKit'},
[body]]
end
end
@ -112,6 +112,18 @@ describe Capybara::Session do
subject.reset!
subject.status_code.should == 0
end
it "should get response headers" do
subject.visit '/'
subject.response_headers['X-Capybara'].should == 'WebKit'
end
it "should reset response headers" do
subject.visit '/'
subject.response_headers['X-Capybara'].should == 'WebKit'
subject.reset!
subject.response_headers['X-Capybara'].should == nil
end
end
end