From 4a0c893f812236527afa34c8fbd4fd4f5bf13c2d Mon Sep 17 00:00:00 2001 From: Matthew O'Riordan Date: Wed, 16 Nov 2011 13:24:16 +0000 Subject: [PATCH] RSpec tests --- Gemfile.lock | 16 ++++++++-------- spec/integration/basic_spec.rb | 23 ++++++++++++++++++++++- spec/spec_helper.rb | 1 + 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 67ddc7b..ba5968b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,14 +31,14 @@ GEM multi_json (~> 1.0) arel (2.2.1) builder (3.0.0) - capybara (1.1.1) + capybara (1.1.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 0.1.4) - capybara-screenshot (0.1.0) + capybara-screenshot (0.1.2) capybara (>= 1.0) cucumber (>= 1.0) capybara-webkit (0.7.2) @@ -46,10 +46,10 @@ GEM childprocess (0.2.2) ffi (~> 1.0.6) columnize (0.3.4) - cucumber (1.1.1) + cucumber (1.1.2) builder (>= 2.1.2) diff-lcs (>= 1.1.2) - gherkin (~> 2.6.0) + gherkin (~> 2.6.2) json (>= 1.4.6) term-ansicolor (>= 1.0.6) cucumber-rails (1.2.0) @@ -58,8 +58,8 @@ GEM nokogiri (>= 1.5.0) diff-lcs (1.1.3) erubis (2.7.0) - ffi (1.0.9) - gherkin (2.6.2) + ffi (1.0.11) + gherkin (2.6.5) json (>= 1.4.6) hike (1.2.1) i18n (0.6.0) @@ -122,9 +122,9 @@ GEM ruby-debug-base (0.10.4) linecache (>= 0.3) rubyzip (0.9.4) - selenium-webdriver (2.10.0) + selenium-webdriver (2.12.2) childprocess (>= 0.2.1) - ffi (= 1.0.9) + ffi (~> 1.0.9) json_pure rubyzip sprockets (2.0.3) diff --git a/spec/integration/basic_spec.rb b/spec/integration/basic_spec.rb index b8c3970..19f4285 100644 --- a/spec/integration/basic_spec.rb +++ b/spec/integration/basic_spec.rb @@ -1,9 +1,30 @@ require 'spec_helper' +describe "a spec not using Capybara" do + it "should pass" do + true.should == true + end + it "should fail and not invoke Capybara" do + true.should == false + end +end + describe "home page", :type => :request do it "simply returns the original HTML when viewed with Rack" do visit '/rack' page.should have_content('Rack') click_link('Does not exist') end -end \ No newline at end of file + + it "generates HTML showing that Javascript under Selenium works", :driver => :selenium do + visit '/selenium' + page.should have_content('Selenium supports Javascript') + click_link('Does not exist') + end + + it "generates HTML showing that Javascript under Capybara-webkit works", :js => true do + visit '/webkit' + page.should have_content('Webkit supports Javascript') + click_link('Does not exist') + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0749d6b..65d6c11 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,7 @@ require 'rspec/autorun' require 'capybara/rspec' +Capybara.javascript_driver = :webkit # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories.