1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00

add spec for status code with image

This commit is contained in:
shogo-ohta 2011-08-23 15:58:20 +09:00
parent 3b025e7115
commit 88b70e37a3

View file

@ -79,6 +79,31 @@ describe Capybara::Session do
subject.click_button('ボタン')
end
end
context "status code" do
before(:all) do
@app = lambda do |env|
params = ::Rack::Utils.parse_query(env['QUERY_STRING'])
if params["img"] == "true"
return [404, { 'Content-Type' => 'image/gif', 'Content-Length' => '0' }, ['not found']]
end
body = <<-HTML
<html>
<body>
<img src="?img=true">
</body>
</html>
HTML
[200,
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
[body]]
end
end
it "should get status code" do
subject.visit '/'
subject.status_code.should == 200
end
end
end
describe Capybara::Session, "with TestApp" do