Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

update cucumber

  • Loading branch information...
commit fb368e23ef5536dbdc85705565183af4a9c26663 1 parent 7d97d28
authored
6 config/environments/cucumber.rb
@@ -21,9 +21,9 @@
21 21 # ActionMailer::Base.deliveries array.
22 22 config.action_mailer.delivery_method = :test
23 23
24   -config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.4' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
25   -config.gem 'database_cleaner', :lib => false, :version => '>=0.4.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
26   -config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
  24 +config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
  25 +config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
  26 +config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
27 27 config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
28 28 config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
29 29
16 features/step_definitions/web_steps.rb
@@ -258,11 +258,21 @@
258 258 end
259 259
260 260 Then /^(?:|I )should be on (.+)$/ do |page_name|
261   - current_path = URI.parse(current_url).select(:path, :query).compact.join('?')
262 261 if defined?(Spec::Rails::Matchers)
263   - current_path.should == path_to(page_name)
  262 + URI.parse(current_url).path.should == path_to(page_name)
264 263 else
265   - assert_equal path_to(page_name), current_path
  264 + assert_equal path_to(page_name), URI.parse(current_url).path
  265 + end
  266 +end
  267 +
  268 +Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
  269 + actual_params = CGI.parse(URI.parse(current_url).query)
  270 + expected_params = Hash[expected_pairs.rows_hash.map{|k,v| [k,[v]]}]
  271 +
  272 + if defined?(Spec::Rails::Matchers)
  273 + actual_params.should == expected_params
  274 + else
  275 + assert_equal expected_params, actual_params
266 276 end
267 277 end
268 278
11 features/support/env.rb
@@ -15,7 +15,6 @@
15 15
16 16 require 'webrat'
17 17 require 'webrat/core/matchers'
18   -#require 'cucumber/webrat/element_locator' # Deprecated in favor of #tableish - remove this line if you don't use #element_at or #table_at
19 18
20 19 Webrat.configure do |config|
21 20 config.mode = :rails
@@ -50,6 +49,10 @@
50 49
51 50 # How to clean your database when transactions are turned off. See
52 51 # http://github.com/bmabey/database_cleaner for more info.
53   -require 'database_cleaner'
54   -DatabaseCleaner.strategy = :truncation
55   -
  52 +if defined?(ActiveRecord::Base)
  53 + begin
  54 + require 'database_cleaner'
  55 + DatabaseCleaner.strategy = :truncation
  56 + rescue LoadError => ignore_if_database_cleaner_not_present
  57 + end
  58 +end

0 comments on commit fb368e2

Please sign in to comment.
Something went wrong with that request. Please try again.