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:
2023-10-03 15:58:56 -07:00
parent 8639c785b7
commit 8b2780820c
3 changed files with 49 additions and 1 deletions
+16
View File
@@ -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