Skip to content
Browse files

update cucumber

  • Loading branch information...
1 parent 7d97d28 commit fb368e23ef5536dbdc85705565183af4a9c26663 @khustochka committed Mar 5, 2010
Showing with 23 additions and 10 deletions.
  1. +3 −3 config/environments/cucumber.rb
  2. +13 −3 features/step_definitions/web_steps.rb
  3. +7 −4 features/support/env.rb
View
6 config/environments/cucumber.rb
@@ -21,9 +21,9 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
-config.gem 'cucumber-rails', :lib => false, :version => '>=0.2.4' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
-config.gem 'database_cleaner', :lib => false, :version => '>=0.4.3' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
-config.gem 'webrat', :lib => false, :version => '>=0.6.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
+config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
+config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
+config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
View
16 features/step_definitions/web_steps.rb
@@ -258,11 +258,21 @@
end
Then /^(?:|I )should be on (.+)$/ do |page_name|
- current_path = URI.parse(current_url).select(:path, :query).compact.join('?')
if defined?(Spec::Rails::Matchers)
- current_path.should == path_to(page_name)
+ URI.parse(current_url).path.should == path_to(page_name)
else
- assert_equal path_to(page_name), current_path
+ assert_equal path_to(page_name), URI.parse(current_url).path
+ end
+end
+
+Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
+ actual_params = CGI.parse(URI.parse(current_url).query)
+ expected_params = Hash[expected_pairs.rows_hash.map{|k,v| [k,[v]]}]
+
+ if defined?(Spec::Rails::Matchers)
+ actual_params.should == expected_params
+ else
+ assert_equal expected_params, actual_params
end
end
View
11 features/support/env.rb
@@ -15,7 +15,6 @@
require 'webrat'
require 'webrat/core/matchers'
-#require 'cucumber/webrat/element_locator' # Deprecated in favor of #tableish - remove this line if you don't use #element_at or #table_at
Webrat.configure do |config|
config.mode = :rails
@@ -50,6 +49,10 @@
# How to clean your database when transactions are turned off. See
# http://github.com/bmabey/database_cleaner for more info.
-require 'database_cleaner'
-DatabaseCleaner.strategy = :truncation
-
+if defined?(ActiveRecord::Base)
+ begin
+ require 'database_cleaner'
+ DatabaseCleaner.strategy = :truncation
+ rescue LoadError => ignore_if_database_cleaner_not_present
+ end
+end

0 comments on commit fb368e2

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