Permalink
Browse files

Capybara extensions automagically loaded

  • Loading branch information...
1 parent 66297fa commit c20518f10702d6ad818064ed16258f451816903d @nando committed Apr 16, 2010
Showing with 38 additions and 7 deletions.
  1. +1 −1 Rakefile
  2. +3 −2 cucumber.yml
  3. +24 −0 features/support/bad_env.rb
  4. +2 −4 features/support/capybara_env.rb
  5. +8 −0 lib/mundo_pepino.rb
View
@@ -16,7 +16,7 @@ unless ARGV.any? {|a| a =~ /^gems/}
build_tasks = [:lib, :rails_generators, :en_US, :es_ES, :capybara_en_US, :capybara_es_ES]
build_tasks.each do |lang|
Cucumber::Rake::Task.new(lang) do |t|
- t.cucumber_opts = "--profile #{lang} --format pretty"
+ t.cucumber_opts = "--profile #{lang} --format progress"
end
end
View
@@ -3,5 +3,6 @@ es_ES: --require features/support/env.rb --require features/step_definitions/es_
en_US: --require features/support/env.rb --require features/step_definitions/en_US.rb features/en_US/
rails_generators: -r features/support/rails_generators_env.rb -r features/step_definitions/rails_generators_steps.rb features/rails_generators/
-capybara_es_ES: --require features/support/capybara/env.rb --require features/step_definitions/es_ES.rb features/es_ES/
-capybara_en_US: --require features/support/capybara/env.rb --require features/step_definitions/en_US.rb features/en_US/
+capybara_es_ES: --require features/support/capybara_env.rb --require features/step_definitions/es_ES.rb features/es_ES/
+capybara_en_US: --require features/support/capybara_env.rb --require features/step_definitions/en_US.rb features/en_US/
+bad_env: --require features/support/bad_env.rb --require features/step_definitions/es_ES.rb features/es_ES/
@@ -0,0 +1,24 @@
+# Sets up the Rails environment for Cucumber
+ENV["RAILS_ENV"] ||= "cucumber"
+require File.expand_path(File.dirname(__FILE__) + '/app/config/environment')
+
+require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
+require 'cucumber/rails/world'
+require 'cucumber/rails/rspec'
+require 'cucumber/rails/active_record'
+require 'cucumber/web/tableish'
+
+
+# Whether or not to allow Rails to rescue errors and render them on
+# an error page. Default is false, which will cause an error to be
+# raised.
+#
+# If you leave this to false, you can turn on Rails rescuing on a
+# per-scenario basis, simply tagging it with @allow-rescue
+ActionController::Base.allow_rescue = false
+
+# Whether or not to run each scenario within a database transaction.
+#
+# If you leave this to true, you can turn off traqnsactions on a
+# per-scenario basis, simply tagging it with @no-txn
+Cucumber::Rails::World.use_transactional_fixtures = true
@@ -1,6 +1,6 @@
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"
-require File.expand_path(File.dirname(__FILE__) + '/../app/config/environment')
+require File.expand_path(File.dirname(__FILE__) + '/app/config/environment')
require 'ruby-debug'
@@ -20,8 +20,6 @@
# steps to use the XPath syntax.
Capybara.default_selector = :css
-require File.expand_path(File.dirname(__FILE__) + '/capextensions')
-
# Whether or not to allow Rails to rescue errors and render them on
# an error page. Default is false, which will cause an error to be
# raised.
@@ -44,4 +42,4 @@
DatabaseCleaner.strategy = :truncation
rescue LoadError => ignore_if_database_cleaner_not_present
end
-end
+end
View
@@ -11,6 +11,14 @@
require 'string-mapper'
+if defined?(Capybara)
+ require 'mundo_pepino/capybara/extensions'
+else
+ unless defined?(Webrat)
+ raise "MundoPepino depends on Capybara or Webrat. Please load any of them and try again. Thanks!"
+ end
+end
+
World(MundoPepino)
module MundoPepino

0 comments on commit c20518f

Please sign in to comment.