Created
September 16, 2011 10:40
-
-
Save chrismdp/1221824 to your computer and use it in GitHub Desktop.
This file contains 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 /^an employee called "([^"]+)"$/ do |employee_name| | |
create_employee(employee_name) | |
end | |
Then /^I should be able to pay "([^"]+)" his salary$/ do |employee_name| | |
pay_salary_to(employee_) | |
end |
This file contains 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
Before("@paul_signed_in") do | |
paul = create_employee("Paul") | |
paul.assign_role("payroll") | |
sign_in_as(paul) | |
end | |
def create_employee(name) | |
Employee.create!(:name => name, :username => name, | |
:password => "password") | |
end | |
def pay_salary_to(name) | |
payee = Employee.find_by_name(name) | |
visit payroll_employee_path(payee) | |
fill_ :salary, :with => payee.salary | |
click_button "Pay" | |
end |
This file contains 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: Paul pays employees | |
In order to retain staff | |
As Paul the Payroll Manager I want to pay my staff | |
@paul_signed_in | |
Scenario: | |
Given an employee called "Bob" | |
Then I should be able to pay "Bob" his salary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment