Created
March 12, 2014 00:49
-
-
Save kronosapiens/9498388 to your computer and use it in GitHub Desktop.
rspec_helper for sinatra-complex-forms-ruby-004
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV["SINATRA_ENV"] = "test" | |
require_relative '../config/environment' | |
require 'rack/test' | |
require 'capybara/rspec' | |
require 'capybara/dsl' | |
if defined?(ActiveRecord::Migrator) && ActiveRecord::Migrator.needs_migration? | |
raise 'Migrations are pending run `rake db:migrate SINATRA_ENV=test` to resolve the issue.' | |
end | |
RSpec.configure do |config| | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
config.run_all_when_everything_filtered = true | |
config.filter_run :focus | |
config.include Rack::Test::Methods | |
config.include Capybara::DSL | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :transaction | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.around(:each) do |example| | |
DatabaseCleaner.cleaning do | |
example.run | |
end | |
end | |
config.order = 'default' | |
end | |
def app | |
Rack::Builder.parse_file('config.ru').first | |
end | |
Capybara.app = app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment