ajmorris (owner)

Revisions

  • 397844 ajmorris Thu Apr 23 10:36:14 -0700 2009
gist: 100631 Download_button fork
public
Public Clone URL: git://gist.github.com/100631.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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