Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kronosapiens/9498388 to your computer and use it in GitHub Desktop.
Save kronosapiens/9498388 to your computer and use it in GitHub Desktop.
rspec_helper for sinatra-complex-forms-ruby-004
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