update for features
+ added flash/message assertions + adjusted urls to be http://google.com for tests for now + added @db-test tags to tests that use db interactions + added a scenario for duplicate URLs being used + added before and after steps to init and clean up db tests + added initialization of a test db for tests instead of interacting with the production database
This commit is contained in:
@@ -1,11 +1,27 @@
|
||||
require_relative '../../.env'
|
||||
ENV["DB_NAME"] = "test_#{ENV["DB_NAME"]}"
|
||||
require_relative '../../app'
|
||||
require 'rubygems'
|
||||
require 'roda'
|
||||
require 'sequel'
|
||||
require 'capybara'
|
||||
require 'capybara/dsl'
|
||||
require 'rspec'
|
||||
|
||||
# DB initialization
|
||||
Sequel.extension :migration
|
||||
Sequel.sqlite("db/#{ENV['DB_NAME']}") do |db|
|
||||
Sequel::Migrator.apply(db, "db/migrations")
|
||||
end
|
||||
|
||||
# RSpec db setup
|
||||
RSpec.configure do |c|
|
||||
c.around(:each) do |example|
|
||||
DB.transaction(rollback: :always, auto_savepoint: true){example.run}
|
||||
end
|
||||
end
|
||||
|
||||
# attach app to Capybara
|
||||
Capybara.app = App
|
||||
|
||||
include Capybara::DSL
|
||||
|
||||
Reference in New Issue
Block a user