Commit 9f25657ad9b48dab20188bfa51aacbe2e83689e5
1 parent
decb3abf
Exists in
master
and in
4 other branches
modify env file for spinach
Showing
1 changed file
with
7 additions
and
57 deletions
Show diff stats
features/support/env.rb
1 | -unless ENV['CI'] | |
2 | - require 'simplecov' | |
3 | - SimpleCov.start 'rails' | |
4 | -end | |
1 | +ENV['RAILS_ENV'] = 'test' | |
2 | +require './config/environment' | |
5 | 3 | |
6 | -require 'cucumber/rails' | |
7 | -require 'webmock/cucumber' | |
4 | +require 'rspec' | |
5 | +require 'database_cleaner' | |
8 | 6 | |
9 | -WebMock.allow_net_connect! | |
10 | - | |
11 | -require Rails.root.join 'spec/support/gitolite_stub' | |
12 | -require Rails.root.join 'spec/support/stubbed_repository' | |
13 | -require Rails.root.join 'spec/support/login_helpers' | |
14 | -require Rails.root.join 'spec/support/valid_commit' | |
15 | - | |
16 | -Capybara.default_selector = :css | |
17 | -Capybara.javascript_driver = :webkit | |
18 | - | |
19 | -# By default, any exception happening in your Rails application will bubble up | |
20 | -# to Cucumber so that your scenario will fail. This is a different from how | |
21 | -# your application behaves in the production environment, where an error page will | |
22 | -# be rendered instead. | |
23 | -# | |
24 | -# Sometimes we want to override this default behaviour and allow Rails to rescue | |
25 | -# exceptions and display an error page (just like when the app is running in production). | |
26 | -# Typical scenarios where you want to do this is when you test your error pages. | |
27 | -# There are two ways to allow Rails to rescue exceptions: | |
28 | -# | |
29 | -# 1) Tag your scenario (or feature) with @allow-rescue | |
30 | -# | |
31 | -# 2) Set the value below to true. Beware that doing this globally is not | |
32 | -# recommended as it will mask a lot of errors for you! | |
33 | -# | |
34 | -ActionController::Base.allow_rescue = false | |
35 | - | |
36 | -# Remove/comment out the lines below if your app doesn't have a database. | |
37 | -# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. | |
38 | -begin | |
39 | - DatabaseCleaner.strategy = :transaction | |
40 | -rescue NameError | |
41 | - raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." | |
42 | -end | |
43 | - | |
44 | -Cucumber::Rails::Database.javascript_strategy = :truncation | |
45 | - | |
46 | -require 'headless' | |
47 | - | |
48 | -headless = Headless.new | |
49 | -headless.start | |
50 | - | |
51 | -require 'cucumber/rspec/doubles' | |
52 | - | |
53 | -include GitoliteStub | |
54 | - | |
55 | -Before do | |
56 | - stub_gitolite! | |
57 | -end | |
58 | - | |
59 | -World(FactoryGirl::Syntax::Methods) | |
7 | +DatabaseCleaner.strategy = :transaction | |
8 | +Spinach.hooks.before_scenario { DatabaseCleaner.start } | |
9 | +Spinach.hooks.after_scenario { DatabaseCleaner.clean } | ... | ... |