mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Update to rspec2
Use rspec2's metadata features to skip celerity specs when run in MRI and culerity specs when jruby is not installed.
This commit is contained in:
parent
2ec8657308
commit
19e1ffc084
10 changed files with 68 additions and 56 deletions
1
.rspec
Normal file
1
.rspec
Normal file
|
|
@ -0,0 +1 @@
|
|||
--color
|
||||
24
Gemfile.lock
24
Gemfile.lock
|
|
@ -14,9 +14,10 @@ PATH
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
celerity (0.7.9)
|
||||
celerity (0.8.2)
|
||||
configuration (1.1.0)
|
||||
culerity (0.2.10)
|
||||
culerity (0.2.12)
|
||||
diff-lcs (1.1.2)
|
||||
ffi (0.6.3)
|
||||
rake (>= 0.8.7)
|
||||
ffi (0.6.3-java)
|
||||
|
|
@ -25,14 +26,23 @@ GEM
|
|||
configuration (>= 0.0.5)
|
||||
rake (>= 0.8.1)
|
||||
mime-types (1.16)
|
||||
nokogiri (1.4.2)
|
||||
nokogiri (1.4.2-java)
|
||||
nokogiri (1.4.3.1)
|
||||
nokogiri (1.4.3.1-java)
|
||||
weakling (>= 0.0.3)
|
||||
rack (1.2.1)
|
||||
rack-test (0.5.4)
|
||||
rack (>= 1.0)
|
||||
rake (0.8.7)
|
||||
rspec (1.3.0)
|
||||
rspec (2.0.0.beta.22)
|
||||
rspec-core (= 2.0.0.beta.22)
|
||||
rspec-expectations (= 2.0.0.beta.22)
|
||||
rspec-mocks (= 2.0.0.beta.22)
|
||||
rspec-core (2.0.0.beta.22)
|
||||
rspec-expectations (2.0.0.beta.22)
|
||||
diff-lcs (>= 1.1.2)
|
||||
rspec-mocks (2.0.0.beta.22)
|
||||
rspec-core (= 2.0.0.beta.22)
|
||||
rspec-expectations (= 2.0.0.beta.22)
|
||||
rubyzip (0.9.4)
|
||||
selenium-webdriver (0.0.28)
|
||||
ffi (>= 0.6.1)
|
||||
|
|
@ -42,7 +52,7 @@ GEM
|
|||
rack (>= 1.0)
|
||||
weakling (0.0.4-java)
|
||||
xpath (0.1.0)
|
||||
yard (0.5.8)
|
||||
yard (0.6.1)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
|
|
@ -57,7 +67,7 @@ DEPENDENCIES
|
|||
nokogiri (>= 1.3.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
rspec (>= 1.2.9)
|
||||
rspec (>= 2.0.0.beta.22)
|
||||
selenium-webdriver (>= 0.0.27)
|
||||
sinatra (>= 0.9.4)
|
||||
xpath (>= 0.1.0)
|
||||
|
|
|
|||
7
Rakefile
7
Rakefile
|
|
@ -1,12 +1,9 @@
|
|||
require 'rubygems'
|
||||
require 'spec/rake/spectask'
|
||||
require 'rspec/core/rake_task'
|
||||
require 'yard'
|
||||
|
||||
desc "Run all examples"
|
||||
Spec::Rake::SpecTask.new('spec') do |t|
|
||||
t.spec_opts = ['--color']
|
||||
t.spec_files = FileList['spec/**/*_spec.rb']
|
||||
end
|
||||
RSpec::Core::RakeTask.new('spec')
|
||||
|
||||
YARD::Rake::YardocTask.new do |t|
|
||||
t.files = ['lib/**/*.rb', 'README.rdoc']
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|||
s.add_runtime_dependency("xpath", [">= 0.1.0"])
|
||||
|
||||
s.add_development_dependency("sinatra", [">= 0.9.4"])
|
||||
s.add_development_dependency("rspec", [">= 1.2.9"])
|
||||
s.add_development_dependency("rspec", [">= 2.0.0.beta.22"])
|
||||
s.add_development_dependency("launchy", [">= 0.3.5"])
|
||||
s.add_development_dependency("yard", [">= 0.5.8"])
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
if RUBY_PLATFORM =~ /java/
|
||||
describe Capybara::Driver::Celerity do
|
||||
describe Capybara::Driver::Celerity, :jruby => :platform do
|
||||
before(:all) do
|
||||
@driver = TestSessions::Celerity.driver
|
||||
end
|
||||
|
|
@ -12,6 +11,3 @@ if RUBY_PLATFORM =~ /java/
|
|||
it_should_behave_like "driver with status code support"
|
||||
it_should_behave_like "driver with cookies support"
|
||||
end
|
||||
else
|
||||
puts "#{File.basename(__FILE__)} requires JRuby; skipping.."
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Capybara::Driver::Culerity do
|
||||
describe Capybara::Driver::Culerity, :jruby => :installed do
|
||||
|
||||
before(:all) do
|
||||
@driver = TestSessions::Culerity.driver
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Capybara::Driver::Culerity do
|
||||
describe Capybara::Driver::Culerity, :jruby => :installed do
|
||||
before(:all) do
|
||||
Capybara.app_host = "http://capybara-testapp.heroku.com"
|
||||
@driver = TestSessions::Culerity.driver
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
if RUBY_PLATFORM =~ /java/
|
||||
describe Capybara::Driver::Celerity do
|
||||
describe Capybara::Driver::Celerity, :jruby => :platform do
|
||||
before(:all) do
|
||||
@session = TestSessions::Celerity
|
||||
end
|
||||
|
|
@ -23,6 +22,3 @@ if RUBY_PLATFORM =~ /java/
|
|||
it_should_behave_like "session with headers support"
|
||||
it_should_behave_like "session with status code support"
|
||||
end
|
||||
else
|
||||
puts "#{File.basename(__FILE__)} requires JRuby; skipping.."
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Capybara::Session do
|
||||
describe Capybara::Session, :jruby => :installed do
|
||||
context 'with culerity driver' do
|
||||
before(:all) do
|
||||
@session = TestSessions::Culerity
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ $:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
|||
require 'rubygems'
|
||||
require "bundler/setup"
|
||||
|
||||
require 'spec'
|
||||
require 'spec/autorun'
|
||||
require 'rspec'
|
||||
require 'capybara'
|
||||
require 'capybara/spec/driver'
|
||||
require 'capybara/spec/session'
|
||||
|
|
@ -20,7 +19,19 @@ module TestSessions
|
|||
Celerity = Capybara::Session.new(:celerity, TestApp)
|
||||
end
|
||||
|
||||
Spec::Runner.configure do |config|
|
||||
RSpec.configure do |config|
|
||||
|
||||
running_with_jruby = RUBY_PLATFORM =~ /java/
|
||||
jruby_installed = `which jruby` && $?.success?
|
||||
|
||||
warn "** Skipping Celerity specs because platform is not Java" unless running_with_jruby
|
||||
warn "** Skipping Culerity specs because JRuby is not installed" unless jruby_installed
|
||||
|
||||
config.filter_run_excluding(:jruby => lambda { |value|
|
||||
return true if value == :platform && !running_with_jruby
|
||||
return true if value == :installed && !jruby_installed
|
||||
})
|
||||
|
||||
config.before do
|
||||
Capybara.configure do |config|
|
||||
config.default_selector = :xpath
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue