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
+19
View File
@@ -1,9 +1,18 @@
# BEFORE
Before('@db-test') do
@links = Sequel.sqlite("db/#{ENV['DB_NAME']}")[:links]
end
# GIVEN
Given('I visit the {string} page') do |string|
visit string
end
Given('A link already exists with the url {string}') do |string|
@links.insert(url: string, code: "aaaaaa")
end
# WHEN
When('I click the {string} button') do |string|
@@ -31,3 +40,13 @@ end
Then('I should be on {string} page') do |string|
page.should have_current_path string
end
Then('I should see the message {string}') do |message|
page.should have_selector '#message', text: message
end
# AFTER
After('@db-test') do
@links.delete
end