dox Executable Documentation

Create order

Auto fill fields

Given I am logged in as admin
Given now is '2013-04-01'
When I open the page
Then the first day field should contain '2013-04-08'
Then the last day field should contain '2013-04-12'
Then the deadline field should contain '2013-04-04 18:00'
Then there should be no error message

One week

Given I am logged in as admin
Given I have entered the first day '2013-04-08'
Given I have entered the last day '2013-04-12'
Given I have entered the deadline '2013-04-04 18:00'
When I create a new order
Then I should be redirected to 'edit.html?order=1'
Then there should be 1 orders
Then there should be an order with the name '08.04.2013 - 12.04.2013'
Then this order should have the deadline '2013-04-04 18:00'
Then this order should have 5 menus
Then the date of menu 1 of this order should be '2013-04-08'
Then the date of menu 5 of this order should be '2013-04-12'
Then menu 1 of this order should have 3 dishes
Then menu 2 of this order should have 3 dishes
Then menu 5 of this order should have 3 dishes

Over the weekend

Given I am logged in as admin
Given I have entered the first day '2013-04-03'
Given I have entered the last day '2013-04-13'
Given I have entered the deadline '2013-04-01 18:00'
When I create a new order
Then there should be 1 orders
Then there should be an order with the name '03.04.2013 - 13.04.2013'
Then this order should have 8 menus
Then the date of menu 1 of this order should be '2013-04-03'
Then the date of menu 2 of this order should be '2013-04-04'
Then the date of menu 3 of this order should be '2013-04-05'
Then the date of menu 4 of this order should be '2013-04-08'
Then the date of menu 5 of this order should be '2013-04-09'
Then the date of menu 6 of this order should be '2013-04-10'
Then the date of menu 7 of this order should be '2013-04-11'
Then the date of menu 8 of this order should be '2013-04-12'

Not admin

Given I have entered the first day '2013-04-03'
Given I have entered the last day '2013-04-13'
Given I have entered the deadline '2013-04-01 18:00'
When I create a new order
Then the error message should be 'Access denied.'

Wrong format

Given I am logged in as admin
Given I have entered the first day 'not a date'
When I create a new order
Then the error message should contain 'Failed to parse time string'

End before start

Given I am logged in as admin
Given I have entered the first day '2013-04-13'
Given I have entered the last day '2013-04-03'
Given I have entered the deadline '2013-04-01 18:00'
When I create a new order
Then the error message should be 'First day must be before last day'

Deadline after start

Given I am logged in as admin
Given I have entered the first day '2013-04-03'
Given I have entered the last day '2013-04-13'
Given I have entered the deadline '2013-04-03 18:00'
When I create a new order
Then the error message should be 'Deadline must be before first day'