Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update to rspec2

Use rspec2's metadata features to skip celerity specs when run in MRI
and culerity specs when jruby is not installed.
  • Loading branch information...
commit 19e1ffc08416e5a7c683801b8c77ebe402318b38 1 parent 2ec8657
@bernerdschaefer bernerdschaefer authored
View
1  .rspec
@@ -0,0 +1 @@
+--color
View
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)
View
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']
View
2  capybara.gemspec
@@ -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
View
22 spec/driver/celerity_driver_spec.rb
@@ -1,17 +1,13 @@
require 'spec_helper'
-if RUBY_PLATFORM =~ /java/
- describe Capybara::Driver::Celerity do
- before(:all) do
- @driver = TestSessions::Celerity.driver
- end
-
- it_should_behave_like "driver"
- it_should_behave_like "driver with javascript support"
- it_should_behave_like "driver with header support"
- it_should_behave_like "driver with status code support"
- it_should_behave_like "driver with cookies support"
+describe Capybara::Driver::Celerity, :jruby => :platform do
+ before(:all) do
+ @driver = TestSessions::Celerity.driver
end
-else
- puts "#{File.basename(__FILE__)} requires JRuby; skipping.."
+
+ it_should_behave_like "driver"
+ it_should_behave_like "driver with javascript support"
+ it_should_behave_like "driver with header support"
+ it_should_behave_like "driver with status code support"
+ it_should_behave_like "driver with cookies support"
end
View
3  spec/driver/culerity_driver_spec.rb
@@ -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
View
2  spec/driver/remote_culerity_driver_spec.rb
@@ -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
View
36 spec/session/celerity_session_spec.rb
@@ -1,28 +1,24 @@
require 'spec_helper'
-if RUBY_PLATFORM =~ /java/
- describe Capybara::Driver::Celerity do
- before(:all) do
- @session = TestSessions::Celerity
- end
+describe Capybara::Driver::Celerity, :jruby => :platform do
+ before(:all) do
+ @session = TestSessions::Celerity
+ end
- describe '#driver' do
- it "should be a celerity driver" do
- @session.driver.should be_an_instance_of(Capybara::Driver::Celerity)
- end
+ describe '#driver' do
+ it "should be a celerity driver" do
+ @session.driver.should be_an_instance_of(Capybara::Driver::Celerity)
end
+ end
- describe '#mode' do
- it "should remember the mode" do
- @session.mode.should == :celerity
- end
+ describe '#mode' do
+ it "should remember the mode" do
+ @session.mode.should == :celerity
end
-
- it_should_behave_like "session"
- it_should_behave_like "session with javascript support"
- 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.."
+
+ it_should_behave_like "session"
+ it_should_behave_like "session with javascript support"
+ it_should_behave_like "session with headers support"
+ it_should_behave_like "session with status code support"
end
View
2  spec/session/culerity_session_spec.rb
@@ -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
View
17 spec/spec_helper.rb
@@ -3,8 +3,7 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.