For what it's worth, I follow the recipe in the Beta version of The
RSpec Book available from http://www.pragprog.com/ as well as watching
the cucumber railscasts at railscasts.com. These are great sources of
info for configuring and using this stack.

I'm running (ubuntu 9.04):

Ruby version              1.8.7 (i686-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.4
Active Record version     2.3.4
Active Resource version   2.3.4
Action Mailer version     2.3.4
Active Support version    2.3.4
Application root          /srv/www/lcre
Environment               development
Database adapter          mysql


[
 ['rspec', false, '>=1.2.9'],
 ['rspec-rails', false, '>=1.2.9'],
 ['thoughtbot-factory_girl', 'factory_girl', '>=1.2.2'],
 ['cucumber', false, '>=0.4.3'],
 ['pickle', false, '>=0.1.22'],
 ['webrat', false, '>=0.5.3'],
 ['Selenium', false, '>=1.1.14'],
 ['selenium-client', false, '>=1.2.17'],
 ['rcov', false, '>=0.9.6'],
 ['mongrel', false, '>=1.1.5'],
 ['launchy', false, '>=0.3.3'],
].each do | gem, lib, version |
  unless File.directory?(File.join(Rails.root, 'vendor/plugins/#
{gem}'))
    config.gem gem, :lib => lib, :version => version
  end
end

with all of the gems actually being at the version specified (as
opposed to something higher).

env.rb (it's a bit of a hack right now as I'm playing around trying to
debug a problem in which Webrat can't find its 'within' method when
running in selenium mode):

require 'rubygems'
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/
environment')
require 'cucumber/rails/world'

# If you set this to true, each scenario will run in a database
transaction.
# You can still turn off transactions on a per-scenario basis, simply
tagging
# a feature or scenario with the @no-txn tag.
#
# If you set this to false, transactions will be off for all
scenarios,
# regardless of whether you use @no-txn or not.
#
# Beware that turning transactions off will leave data in your
database
# after each scenario, which can lead to hard-to-debug failures in
# subsequent scenarios. If you do this, we recommend you create a
Before
# block that will explicitly put your database in a known state.
Cucumber::Rails::World.use_transactional_fixtures = false
# since not using transactional fixtures, need to clean out the db
ourselves
require 'database_cleaner'
require 'database_cleaner/cucumber'
DatabaseCleaner.strategy = :truncation


# If you set this to false, any error raised from within your app will
bubble
# up to your step definition and out to cucumber unless you catch it
somewhere
# on the way. You can make Rails rescue errors and render error pages
on a
# per-scenario basis by tagging a scenario or feature with the @allow-
rescue tag.
#
# If you set this to true, Rails will rescue all errors and render
error
# pages, more or less in the same way your application would behave in
the
# default production environment. It's not recommended to do this for
all
# of your scenarios, as this makes it hard to discover errors in your
application.
ActionController::Base.allow_rescue = false

require 'cucumber'
# Comment out the next line if you don't want Cucumber Unicode support
require 'cucumber/formatter/unicode'
require 'cucumber/webrat/element_locator' # Lets you do table.diff!
(element_at('#my_table_or_dl_or_ul_or_ol').to_table)
require 'cucumber/rails/rspec'

#==================================================
use_selenium = false

require 'selenium' if use_selenium
require 'webrat'
require 'webrat/selenium' if use_selenium

Webrat.configure do |config|
  config.open_error_files = false # Set to true if you want error
pages to pop up in the browser
  if (!use_selenium)
    config.mode = :rails
  else
    config.mode = :selenium
    config.selenium_browser_startup_timeout = 10
    config.selenium_browser_key = "*firefox"
    config.application_framework = :rails
  end

  config.application_environment = :test
end

if use_selenium
  class ActiveSupport::TestCase
    setup do |session|
      session.host! "localhost:3001"
    end
  end
end

#====================================================
require 'factory_girl'
require File.expand_path(File.dirname(__FILE__) + '../../../spec/
factories')

require 'pickle/world'

Pickle.configure do |config|
  config.adapters = [:factory_girl]
  config.map 'I', 'myself', 'me', 'my', :to => 'user: "me"'
end



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to