Sha256: bd1664b7e458879a6a9ab693825c083eb22b15b8543b6f9a212b0c3913342727

Contents?: true

Size: 1.69 KB

Versions: 8

Compression:

Stored size: 1.69 KB

Contents

ENV["RAILS_ENV"] = "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require 'rails/test_help'
require 'rspec/rails'
require 'factory_girl'
require 'capybara/rails'
require 'rake'

FactoryGirl.find_definitions

ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "test.com"

Rails.backtrace_cleaner.remove_silencers!

# Configure capybara for integration testing
Capybara.default_driver   = :rack_test
Capybara.default_selector = :css

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
  # Remove this line if you don't want RSpec's should and should_not
  # methods or matchers
  require 'rspec/expectations'
  require 'carrierwave/test/matchers'

  config.include RSpec::Matchers
  config.include CarrierWave::Test::Matchers
  config.include KuhsaftSpecHelper
  config.include FactoryGirl::Syntax::Methods

  config.before :suite do

    load File.expand_path("../dummy/Rakefile", __FILE__)
    Rake::Task['kuhsaft:install:migrations'].invoke

    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)
    # Drop all records and run any available migration
    ActiveRecord::Base.connection.tables.each { |table| ActiveRecord::Base.connection.drop_table(table) }
    ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
  end

  config.after :suite do
    # remove migrations?
  end

  config.before do
    DatabaseCleaner.start
  end

  config.after do
    DatabaseCleaner.clean
  end

  # == Mock Framework
  config.mock_with :rspec
  config.use_transactional_fixtures = false
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kuhsaft-1.2.5 spec/spec_helper.rb
kuhsaft-1.2.4 spec/spec_helper.rb
kuhsaft-1.2.3 spec/spec_helper.rb
kuhsaft-1.2.2 spec/spec_helper.rb
kuhsaft-1.2.1 spec/spec_helper.rb
kuhsaft-1.2.0 spec/spec_helper.rb
kuhsaft-1.1.1 spec/spec_helper.rb
kuhsaft-1.1.0 spec/spec_helper.rb