Skip to content

Instantly share code, notes, and snippets.

@mikebannister
Created July 30, 2011 19:01
Show Gist options
  • Save mikebannister/1115858 to your computer and use it in GitHub Desktop.
Save mikebannister/1115858 to your computer and use it in GitHub Desktop.
require 'acceptance/support/acceptance_helper'
feature "Add manual timesheet to payroll report", %q{
In order to tweak the payroll report
As an admin
I want to manually attach timesheets to the report
} do
background do
generate_full_payroll_data
# An account that we can select when manually adding timesheet
account = Factory(:account, qb_name: "Lulu Corp")
Factory(:task, name: "Lulu Task", account: account)
# get to the payroll report
sign_in :then_visit => payroll_report_path
select '2010-04-25', :from => :pay_period
click_button 'Run'
end
scenario "Add manual timesheet to report" do
# dig inside the payroll table to get to the cell with the link
within("table#payroll_report tbody tr:first-child td:nth-child(5)") do
click_link "Add manual timesheet"
end
response.should have_selector("h1") do |heading|
heading.should contain "New Manual Timesheet"
end
select 'Lulu Corp:Lulu Task', :from => :task
fill_in 'Date', with: '04/24/2010'
fill_in 'Hours', with: '2'
fill_in 'Note', with: 'A timesheet note'
click_button "Create Manual Timesheet"
response.should contain "Successfully created manual timesheet."
response.should contain "Payroll report for 2010-04-25"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment