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,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
|
||||
|
||||
Reference in New Issue
Block a user