Skip to content

Instantly share code, notes, and snippets.

@ajmorris
Created April 23, 2009 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajmorris/100631 to your computer and use it in GitHub Desktop.
Save ajmorris/100631 to your computer and use it in GitHub Desktop.
Scenario: A user enters an annual request that passes over a holiday
Given an employee wants a request with '7 Apr 2009' to '9 Apr 2009'
And the request passes over a 'blackoutperiod'
And the employee sets the leave type to 'annual'
When the request status is changed to 'approved'
Then I should have '0' hours for my leave request
Given /^an employee wants a request with '(.*)' to '(.*)'$/ do |sdate, edate|
@user = Factory.build(:user, :id => "1")
@rp = Factory.build(:restriction_period, :start_date => '8 Apr 2009',
:end_date => '8 Apr 2009', :type => :blackout_period)
@leave_request = Factory.build(:leave_request, :start_date => Date.parse(sdate),
:end_date => Date.parse(edate),
:user_id => @user.id, :leave_type => "sick")
end
Given /^the employee sets the leave type to '(\w+)'$/ do |type|
@leave_request.leave_type = type
end
When /^the type is '(\w+)'$/ do |type|
assert_equal(type, @leave_request.leave_type)
end
When /^the request status is changed to '(\w+)'$/ do |status|
@leave_request.status = status
end
Then /^I should have '(\d+)' hours for my leave request$/ do |hours|
assert_equal(hours.to_f, @leave_request.leave_total)
end
Given /^the request passes over a '(\w+)'$/ do |type|
@rp.type = type
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment