Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rchampourlier
Created April 3, 2012 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchampourlier/2292731 to your computer and use it in GitHub Desktop.
Save rchampourlier/2292731 to your computer and use it in GitHub Desktop.
Environment for failing spork-rails
# features/support/env.rb
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require 'spork'
Spork.prefork do
require 'cucumber/rails'
require 'cucumber/rails/rspec'
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
# Make sure this require is after you require cucumber/rails/world.
require 'email_spec' # add this line if you use spork
require 'email_spec/cucumber'
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adjust any selectors in your
# steps to use the XPath syntax.
Capybara.default_selector = :css
# By default, any exception happening in your Rails application will bubble up
# to Cucumber so that your scenario will fail. This is a different from how
# your application behaves in the production environment, where an error page will
# be rendered instead.
#
# Sometimes we want to override this default behaviour and allow Rails to rescue
# exceptions and display an error page (just like when the app is running in production).
# Typical scenarios where you want to do this is when you test your error pages.
# There are two ways to allow Rails to rescue exceptions:
#
# 1) Tag your scenario (or feature) with @allow-rescue
#
# 2) Set the value below to true. Beware that doing this globally is not
# recommended as it will mask a lot of errors for you!
#
ActionController::Base.allow_rescue = false
# Remove/comment out the lines below if your app doesn't have a database.
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
begin
DatabaseCleaner.strategy = :transaction
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
# Hackeries from https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujitsu
# For Mongoid
require "rails/mongoid"
Spork.trap_class_method(Rails::Mongoid, :load_models)
# For Devise
require "rails/application"
Spork.trap_method(Rails::Application, :reload_routes!) # different for Rails 3.1
require File.join(File.dirname(__FILE__), "../../config/environment.rb")
end
Spork.each_run do
# This code will be run each time you run your specs.
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
# See the DatabaseCleaner documentation for details. Example:
#
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
# # { :except => [:widgets] } may not do what you expect here
# # as tCucumber::Rails::Database.javascript_strategy overrides
# # this setting.
# DatabaseCleaner.strategy = :truncation
# end
#
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
# DatabaseCleaner.strategy = :transaction
# end
#
# Possible values are :truncation and :transaction
# The :transaction strategy is faster, but might give you threading problems.
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
Cucumber::Rails::Database.javascript_strategy = :truncation
FactoryGirl.reload
end
# Gemfile
source 'http://rubygems.org'
# Framework
gem 'rails', '~> 3.0.9'
gem 'jquery-rails'
# Running
gem 'thin'
gem 'delayed_job_active_record'
gem 'bartt-ssl_requirement', '~> 1.4.0', :require => 'ssl_requirement'
# Datastores
gem "mongoid", "~> 2.2.6"
gem "mongo", "1.6.0"
gem "bson", "1.6.0"
gem "bson_ext", "1.6.0" # C-extensions improving Mongoid performance
gem 'silent-postgres' # Silence PostgreSQL. Logs are unreadable without it.
# Model
gem 'draper' # model decoration
# Authentication
gem 'devise'
gem 'omniauth', "~> 0.3.2"
# Assets, formatting
gem 'compass', ">= 0.11.5"
gem 'haml'
gem 'will_paginate' # easy pagination
gem 'formtastic', "~> 2.1.1" # nice forms
gem 'redcarpet' # Markdown processing
# File-upload
gem 'paperclip' # standard image upload
gem 'carrierwave' # better file upload
# Rich content
gem 'gmaps4rails', "~> 1.3.2" # locations on a google map
gem 'vpim' # vcards
# Social network
gem 'twitter'
gem 'linkedin', :git => "https://github.com/pengwynn/linkedin.git", :tag => '2-0-stable'
# Application-level monitoring
gem 'hoptoad_notifier'
gem 'newrelic_rpm'
# Being reviewed
gem 'prawn'
gem 'prawnto'
gem 'prawn-fast-png'
gem 'rmagick'
gem 'rqrcode-rails3'
gem 'mini_magick'
group :development do
gem 'jammit'
gem 'annotate'
gem 'capistrano'
gem 'capistrano-ext'
gem 'french_cuisine_deploy', :git => "git@github.com:rchampourlier/french_cuisine_deploy.git", :require => false # We only want this gem to be required from our deploy.rb.
gem 'guard'
gem 'guard-bundler'
gem 'guard-rspec'
gem 'guard-spork'
gem 'growl'
gem 'sqlite3-ruby', :require => 'sqlite3' # Needed until all development environments use PostgreSQL
end
group :test do
#gem 'factory_girl_rails', :require => false
# We use it for development seeding
# We want it not required to deal with Spork: https://github.com/timcharper/spork/wiki/Troubleshooting
gem 'cucumber-rails', '~> 1.0', require: false
gem 'guard-cucumber'
gem 'database_cleaner'
gem 'capybara', '~> 1.0'
gem 'email_spec'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails', '~> 2.9'
gem 'rspec-expectations', :git => "https://github.com/rspec/rspec-expectations.git", :branch => 'master'
gem 'spork-rails', '~> 3.2.0'
#gem 'spork', '~> 1.0.0rc2'
gem 'rb-fsevent', :require => false #if RUBY_PLATFORM =~ /darwin/i # can't use this, or it break Gemfile.lock for other platforms
gem 'ruby-debug19', :require => 'ruby-debug'
end
group :production do
# Datastores
gem 'pg'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment