Sha256: 48652ebf4187b4ac1eca2b8f2a0b10c42c25d73fad7829e8d6186edc458e44d9

Contents?: true

Size: 1.91 KB

Versions: 2

Compression:

Stored size: 1.91 KB

Contents

def setup_environment
  # Configure Rails Environment
  ENV["RAILS_ENV"] = 'test'

  unless ENV['COVERAGE'] || ENV['TRAVIS']
    require 'simplecov'
    SimpleCov.start 'rails'
  end

  if File.exist?(dummy_path = File.expand_path('../dummy/config/environment.rb', __FILE__))
    require dummy_path
  elsif File.dirname(__FILE__) =~ %r{vendor/extensions}
    # Require the path to the refinerycms application this is vendored inside.
    require File.expand_path('../../../../../config/environment', __FILE__)
  end

  require 'rspec/rails'
  require 'capybara/rspec'

  Rails.backtrace_cleaner.remove_silencers!

  Capybara.javascript_driver = :webkit

  RSpec.configure do |config|
    config.mock_with :rspec
    config.treat_symbols_as_metadata_keys_with_true_values = true
    config.filter_run :focus => true
    config.run_all_when_everything_filtered = true
  end
end

def each_run
  if ENV['COVERAGE'] && !ENV['TRAVIS']
    require 'simplecov'
    SimpleCov.start 'rails'
  end

  Rails.cache.clear
  ActiveSupport::Dependencies.clear
  FactoryGirl.reload

  # Requires supporting files with custom matchers and macros, etc,
  # in ./support/ and its subdirectories including factories.
  ([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
    Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
  }.flatten.sort.each do |support_file|
    require support_file
  end
end

# If spork is available in the Gemfile it'll be used but we don't force it.
unless (begin; require 'spork'; rescue LoadError; nil end).nil? || ENV['TRAVIS']
  Spork.prefork do
    # Loading more in this block will cause your tests to run faster. However,
    # if you change any configuration or code from libraries loaded here, you'll
    # need to restart spork for it take effect.
    setup_environment
  end

  Spork.each_run do
    # This code will be run each time you run your specs.
    each_run
  end
else
  setup_environment
  each_run
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-menus-2.0.7 spec/spec_helper.rb
refinerycms-menus-2.0.6 spec/spec_helper.rb