1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Moved shared specs into lib directory

This way, implementations of other drivers can
use the specs to verify that they are working
correctly.
This commit is contained in:
Jonas Nicklas 2010-04-09 16:41:35 +02:00
parent 14e08240ca
commit cf1aa4d073
50 changed files with 42 additions and 59 deletions

View file

@ -1,4 +1,8 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'capybara/spec/test_app'
Dir[File.dirname(__FILE__)+'/driver/*'].each { |group|
require group
}
shared_examples_for 'driver' do

View file

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 332 B

View file

@ -1,6 +1,10 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'capybara/spec/test_app'
require 'nokogiri'
Dir[File.dirname(__FILE__)+'/session/*'].each { |group|
require group
}
shared_examples_for "session" do
def extract_results(session)
YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text

View file

@ -0,0 +1,19 @@
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
shared_examples_for "session without headers support" do
describe "#response_headers" 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

View file

@ -1,7 +1,3 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'nokogiri'
shared_examples_for "session with javascript support" do
describe 'all JS specs' do
before do
@ -195,3 +191,14 @@ shared_examples_for "session with javascript support" do
end
end
shared_examples_for "session without javascript support" do
describe "#evaluate_script" do
before{ @session.visit('/with_simple_html') }
it "should raise an error" do
running {
@session.evaluate_script('3 + 3')
}.should raise_error(Capybara::NotSupportedByDriverError)
end
end
end

View file

@ -1,13 +0,0 @@
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

View file

@ -1,15 +0,0 @@
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

View file

@ -1,15 +0,0 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))
require 'nokogiri'
shared_examples_for "session without javascript support" do
describe "#evaluate_script" do
before{ @session.visit('/with_js') }
it "should raise an error" do
running {
@session.evaluate_script("1+5")
}.should raise_error(Capybara::NotSupportedByDriverError)
end
end
end

View file

@ -5,16 +5,8 @@ require 'rubygems'
require 'spec'
require 'spec/autorun'
require 'capybara'
require 'test_app'
require 'drivers_spec'
require 'session_spec'
Dir[File.dirname(__FILE__)+'/dsl/*'].each { |group|
require 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'
require 'capybara/spec/driver'
require 'capybara/spec/session'
alias :running :lambda