Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 54 lines (43 sloc) 1.469 kB
bb48274 @parndt Set up testing for project
parndt authored
1 require 'rubygems'
2
3 def setup_environment
4 # Configure Rails Environment
5 ENV["RAILS_ENV"] ||= 'test'
6
7 require File.expand_path("../dummy/config/environment", __FILE__)
8
9 require 'rspec/rails'
10 require 'capybara/rspec'
11 require 'factory_girl_rails'
12
13 Rails.backtrace_cleaner.remove_silencers!
14
15 RSpec.configure do |config|
16 config.mock_with :rspec
17 config.treat_symbols_as_metadata_keys_with_true_values = true
18 config.filter_run :focus => true
19 config.run_all_when_everything_filtered = true
20 end
21 end
22
23 def each_run
24 ActiveSupport::Dependencies.clear
25
26 FactoryGirl.reload
27
28 # Requires supporting files with custom matchers and macros, etc,
29 # in ./support/ and its subdirectories including factories.
30 ([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
31 Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
32 }.flatten.sort.each do |support_file|
33 require support_file
34 end
35 end
36
37 # If spork is available in the Gemfile it'll be used but we don't force it.
38 unless (begin; require 'spork'; rescue LoadError; nil end).nil?
39 Spork.prefork do
40 # Loading more in this block will cause your tests to run faster. However,
41 # if you change any configuration or code from libraries loaded here, you'll
42 # need to restart spork for it take effect.
43 setup_environment
44 end
45
46 Spork.each_run do
47 # This code will be run each time you run your specs.
48 each_run
49 end
50 else
51 setup_environment
52 each_run
53 end
Something went wrong with that request. Please try again.