-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager_schedule_shift.feature
68 lines (63 loc) · 2.71 KB
/
manager_schedule_shift.feature
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Feature: As a manager,
I want to schedule my employees,
by creating shifts for any employee.
Background:
Given I have users:
| id | name | email | role | password | phone |
| employee_1 | employee1 | [email protected] | employee | $2y$10$VNc/MX2Mi3Um1wydjDJ.jOGjMpQ6TvWuiXFuKWq3bYUh0EblZNN1i | (612) 111-1111 |
| manager_1 | manager | [email protected] | manager | $2y$10$VNc/MX2Mi3Um1wydjDJ.jOGjMpQ6TvWuiXFuKWq3bYUh0EblZNN1i | (952) 952 952 |
And I set header "Content-Type" with value "application/json"
And I set header "Accept" with value "application/json"
And I login with credentials "[email protected]" "foobar"
Scenario: As a manager,
I want to schedule my employees,
by creating shifts for any employee.
Given I send a POST request to "/shifts" with body:
"""
{
"employee_id": "employee_1",
"start_time": "Fri, 07 Mar 2014 08:30:00",
"end_time": "Fri, 07 Mar 2014 17:30:00",
"break": "0.5"
}
"""
Then The response validates:
| property | value | type |
| shift.id | <skip> | string |
| shift.start | Fri, 07 Mar 14 08:30:00 +0000 | string |
| shift.end | Fri, 07 Mar 14 17:30:00 +0000 | string |
| shift.break | 0.5 | string |
| shift.manager.id | manager_1 | string |
| shift.manager.name | manager | string |
| shift.manager.email | [email protected] | string |
| shift.manager.phone | (952) 952 952 | string |
| shift.employee.id | employee_1 | string |
| shift.employee.name | employee1 | string |
| shift.employee.email | [email protected] | string |
| shift.employee.phone | (612) 111-1111 | string |
Scenario: As a manager,
If I schedule a shift for an invalid employee,
I get a 400 error
Given I send a POST request to "/shifts" with body:
"""
{
"employee_id": "foobar",
"start_time": "Fri, 07 Mar 2014 08:30:00",
"end_time": "Fri, 07 Mar 2014 17:30:00",
"break": "0.5"
}
"""
Then the response code should be 400
Scenario: As a manager,
If I schedule a shift with a start date preceding the end date,
I get a 400 error
Given I send a POST request to "/shifts" with body:
"""
{
"employee_id": "employee_1",
"start_time": "Fri, 07 Mar 2014 05:30:00",
"end_time": "Fri, 07 Mar 2014 04:30:00",
"break": "0.5"
}
"""
Then the response code should be 400