mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Session integration & specs for response_headers
This commit is contained in:
parent
5c22edb7cd
commit
598ccb3826
7 changed files with 37 additions and 3 deletions
|
@ -29,7 +29,7 @@ module Capybara
|
|||
end
|
||||
|
||||
def response_headers
|
||||
driver.response.headers
|
||||
driver.response_headers
|
||||
end
|
||||
|
||||
def visit(path)
|
||||
|
@ -99,7 +99,7 @@ module Capybara
|
|||
end
|
||||
|
||||
def body
|
||||
driver.response.body
|
||||
driver.body
|
||||
end
|
||||
|
||||
def has_content?(content)
|
||||
|
|
|
@ -8,7 +8,7 @@ describe Capybara::Session do
|
|||
|
||||
describe '#driver' do
|
||||
it "should be a rack test driver" do
|
||||
@session.driver.should be_an_instance_of(Capybara::Driver::Celerity)
|
||||
@session.driver.should be_an_instance_of(Capybara::Driver::Culerity)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -20,5 +20,6 @@ describe Capybara::Session do
|
|||
|
||||
it_should_behave_like "session"
|
||||
it_should_behave_like "session with javascript support"
|
||||
it_should_behave_like "session with headers support"
|
||||
end
|
||||
end
|
|
@ -20,5 +20,6 @@ describe Capybara::Session do
|
|||
|
||||
it_should_behave_like "session"
|
||||
it_should_behave_like "session without javascript support"
|
||||
it_should_behave_like "session with headers support"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,5 +20,6 @@ describe Capybara::Session do
|
|||
|
||||
it_should_behave_like "session"
|
||||
it_should_behave_like "session with javascript support"
|
||||
it_should_behave_like "session without headers support"
|
||||
end
|
||||
end
|
||||
|
|
13
spec/session_with_headers_support_spec.rb
Normal file
13
spec/session_with_headers_support_spec.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
||||
|
||||
|
||||
shared_examples_for "session with headers support" do
|
||||
|
||||
describe '#response_headers' do
|
||||
it "should return response headers" do
|
||||
@session.visit('/with_simple_html')
|
||||
@session.response_headers['Content-Type'].should == 'text/html'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
15
spec/session_without_headers_support_spec.rb
Normal file
15
spec/session_without_headers_support_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
||||
|
||||
require 'nokogiri'
|
||||
|
||||
shared_examples_for "session without headers support" do
|
||||
describe "#evaluate_script" do
|
||||
before{ @session.visit('/with_simple_html') }
|
||||
it "should raise an error" do
|
||||
running {
|
||||
@session.response_headers
|
||||
}.should raise_error(Capybara::NotSupportedByDriverError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -12,4 +12,7 @@ Dir[File.dirname(__FILE__)+'/dsl/*'].each { |group|
|
|||
}
|
||||
require 'session_with_javascript_support_spec'
|
||||
require 'session_without_javascript_support_spec'
|
||||
require 'session_with_headers_support_spec'
|
||||
require 'session_without_headers_support_spec'
|
||||
|
||||
alias :running :lambda
|
||||
|
|
Loading…
Reference in a new issue