|
|
@ -26,6 +26,10 @@ |
|
|
|
# See doc/COPYRIGHT.rdoc for more details. |
|
|
|
# See doc/COPYRIGHT.rdoc for more details. |
|
|
|
#++ |
|
|
|
#++ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getWPRowByName(name) |
|
|
|
|
|
|
|
find("a", :text => name).find(:xpath, "./ancestor::tr") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
Given(/^there are the following work packages were added "(.*?)"(?: in project "([^"]*)")?:$/) do |time, project_name, table| |
|
|
|
Given(/^there are the following work packages were added "(.*?)"(?: in project "([^"]*)")?:$/) do |time, project_name, table| |
|
|
|
project = get_project(project_name) |
|
|
|
project = get_project(project_name) |
|
|
|
|
|
|
|
|
|
|
@ -36,12 +40,9 @@ Given(/^there are the following work packages were added "(.*?)"(?: in project " |
|
|
|
else |
|
|
|
else |
|
|
|
target_time = Time.now |
|
|
|
target_time = Time.now |
|
|
|
end |
|
|
|
end |
|
|
|
Timecop.travel(target_time) |
|
|
|
Timecop.freeze(target_time) do |
|
|
|
|
|
|
|
create_work_packages_from_table table, project |
|
|
|
create_work_packages_from_table table, project |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
# Ensure timecop returns after each scenario |
|
|
|
|
|
|
|
Support::ResetTimecop.reset_after |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
Given(/^the work package "(.*?)" was changed "(.*?)" to:$/) do |name, time, table| |
|
|
|
Given(/^the work package "(.*?)" was changed "(.*?)" to:$/) do |name, time, table| |
|
|
@ -56,17 +57,17 @@ Given(/^the work package "(.*?)" was changed "(.*?)" to:$/) do |name, time, tabl |
|
|
|
else |
|
|
|
else |
|
|
|
target_time = Time.now |
|
|
|
target_time = Time.now |
|
|
|
end |
|
|
|
end |
|
|
|
Timecop.travel(target_time) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#TODO provide generic support for all possible values. |
|
|
|
Timecop.freeze(target_time) do |
|
|
|
work_package = WorkPackage.find_by_subject(name) |
|
|
|
|
|
|
|
work_package.subject = table.hashes.first[:subject] |
|
|
|
|
|
|
|
work_package.start_date = table.hashes.first[:start_date] |
|
|
|
|
|
|
|
work_package.due_date = table.hashes.first[:due_date] |
|
|
|
|
|
|
|
work_package.save! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ensure timecop returns after each scenario |
|
|
|
#TODO provide generic support for all possible values. |
|
|
|
Support::ResetTimecop.reset_after |
|
|
|
work_package = WorkPackage.find_by_subject(name) |
|
|
|
|
|
|
|
work_package.subject = table.hashes.first[:subject] |
|
|
|
|
|
|
|
work_package.start_date = table.hashes.first[:start_date] |
|
|
|
|
|
|
|
work_package.due_date = table.hashes.first[:due_date] |
|
|
|
|
|
|
|
work_package.save! |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
When(/^I set the timeline to compare "now" to "(.*?) days ago"$/) do |time| |
|
|
|
When(/^I set the timeline to compare "now" to "(.*?) days ago"$/) do |time| |
|
|
@ -81,12 +82,14 @@ When(/^I set the timeline to compare "now" to "(.*?) days ago"$/) do |time| |
|
|
|
page.execute_script("jQuery('#content form').submit()") |
|
|
|
page.execute_script("jQuery('#content form').submit()") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
Then(/^I should see the work package "(.*?)" has not moved$/) do |arg1| |
|
|
|
Then(/^I should see the work package "(.*?)" has not moved$/) do |name| |
|
|
|
pending # express the regexp above with the code you wish you had |
|
|
|
row = getWPRowByName(name) |
|
|
|
|
|
|
|
row.should_not have_selector(".tl-icon-changed"); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
Then(/^I should see the work package "(.*?)" has moved$/) do |arg1| |
|
|
|
Then(/^I should see the work package "(.*?)" has moved$/) do |name| |
|
|
|
pending # express the regexp above with the code you wish you had |
|
|
|
row = getWPRowByName(name) |
|
|
|
|
|
|
|
row.should have_selector(".tl-icon-changed"); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
Then(/^I should not see the work package "(.*?)"$/) do |arg1| |
|
|
|
Then(/^I should not see the work package "(.*?)"$/) do |arg1| |
|
|
|