diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb index 04262a8..0bd3ae6 100644 --- a/features/step_definitions/steps.rb +++ b/features/step_definitions/steps.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true + # BEFORE Before('@db-test') do - @links = Sequel.sqlite("db/#{ENV['DB_NAME']}")[:links] + @links = Sequel.sqlite("db/#{ENV.fetch('DB_NAME', nil)}")[:links] end - # GIVEN Given('I visit the {string} page') do |string| @@ -11,18 +12,17 @@ Given('I visit the {string} page') do |string| end Given('A link already exists with the url {string}') do |string| - @links.insert(url: string, code: "aaaaaa") + @links.insert(url: string, code: 'aaaaaa') end Given('A link already exists with the url {string} and code {string}') do |url, code| - @links.insert(url: url, code: code) + @links.insert(url:, code:) end - # WHEN When('I click the {string} button') do |string| - click_button {string} + click_button { string } end When('I type {string} in the {string} field') do |text, field| @@ -33,7 +33,6 @@ When('I visit the {string} location') do |string| visit string end - # THEN Then('I should see text {string}') do |string| @@ -66,7 +65,6 @@ Then('The status code should be {int}') do |code| page.status_code.should eq(code) end - # AFTER After('@db-test') do