Last active
November 18, 2016 04:25
-
-
Save BaylorRae/cedb1ccfb726fdca0b7e89c76ea8df47 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: purchase product | |
Scenario: purchase product | |
Given seller has created a product | |
When buyer purchases the product | |
And buyer sends payment | |
Then seller should receive money | |
And the product shouldn't be listed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given(/^(.*) has created a product$/) do |username| | |
UserManager.change_user(username) | |
end | |
When(/^(.*) purchases the product$/) do |username| | |
UserManager.change_user(username) | |
end | |
When(/^(.*) sends payment$/) do |username| | |
UserManager.change_user(username) | |
end | |
Then(/^(.*) should receive money$/) do |username| | |
UserManager.change_user(username) | |
end | |
Then(/^the product shouldn't be listed$/) do | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoginPage | |
def self.login_as(username) | |
# fill in login fields and submit form here | |
puts "Logged in as #{username}" | |
end | |
end | |
class UserManager | |
def self.change_user(username) | |
return if @current_username == username | |
@current_username = username | |
LoginPage.login_as(username) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment