Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests for selenium driver exit codes. #463

  • Loading branch information...
commit 8d0442073d4fef8740a324d42e5342b3dfd54c0c 1 parent 5f4c537
@ebeigarts ebeigarts authored
View
21 spec/driver/selenium_driver_spec.rb
@@ -26,4 +26,25 @@
browser.quit
end
end
+
+ describe "exit codes" do
+ before do
+ @current_dir = Dir.getwd
+ Dir.chdir(File.join(File.dirname(__FILE__), '..', '..'))
+ end
+
+ after do
+ Dir.chdir(@current_dir)
+ end
+
+ it "should have return code 1 when running selenium_driver_rspec_failure.rb" do
+ `rspec spec/fixtures/selenium_driver_rspec_failure.rb`
+ $?.exitstatus.should be 1
+ end
+
+ it "should have return code 0 when running selenium_driver_rspec_success.rb" do
+ `rspec spec/fixtures/selenium_driver_rspec_success.rb`
+ $?.exitstatus.should be 0
+ end
+ end
end
View
8 spec/fixtures/selenium_driver_rspec_failure.rb
@@ -0,0 +1,8 @@
+require 'spec_helper'
+
+describe Capybara::Selenium::Driver do
+ it "should exit with a non-zero exit status when assertion fails" do
+ browser = Capybara::Selenium::Driver.new(TestApp).browser
+ true.should == false
+ end
+end
View
8 spec/fixtures/selenium_driver_rspec_success.rb
@@ -0,0 +1,8 @@
+require 'spec_helper'
+
+describe Capybara::Selenium::Driver do
+ it "should exit with a non-zero exit status when assertion fails" do
+ browser = Capybara::Selenium::Driver.new(TestApp).browser
+ true.should == true
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.