spec/timetrap_spec.rb in samg-timetrap-0.0.4 vs spec/timetrap_spec.rb in samg-timetrap-0.0.5
- old
+ new
@@ -84,32 +84,32 @@
)
Time.stub!(:now).and_return Time.at(1223254800 + (60*60*2))
@desired_output = <<-OUTPUT
Timesheet: SpecSheet
- Day Start End Duration Notes
- Fri Oct 03, 2008 12:00:00 - 14:00:00 2:00:00 entry 1
- 16:00:00 - 18:00:00 2:00:00 entry 2
- 4:00:00
- Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 entry 3
- 18:00:00 - 2:00:00 entry 4
- 4:00:00
- ---------------------------------------------------------
- Total 8:00:00
+ Day Start End Duration Notes
+ Fri Oct 03, 2008 12:00:00 - 14:00:00 2:00:00 entry 1
+ 16:00:00 - 18:00:00 2:00:00 entry 2
+ 4:00:00
+ Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 entry 3
+ 18:00:00 - 2:00:00 entry 4
+ 4:00:00
+ ---------------------------------------------------------
+ Total 8:00:00
OUTPUT
@desired_output_with_ids = <<-OUTPUT
Timesheet: SpecSheet
- Id Day Start End Duration Notes
- 3 Fri Oct 03, 2008 12:00:00 - 14:00:00 2:00:00 entry 1
- 2 16:00:00 - 18:00:00 2:00:00 entry 2
- 4:00:00
- 4 Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 entry 3
- 5 18:00:00 - 2:00:00 entry 4
- 4:00:00
- ---------------------------------------------------------
- Total 8:00:00
+Id Day Start End Duration Notes
+3 Fri Oct 03, 2008 12:00:00 - 14:00:00 2:00:00 entry 1
+2 16:00:00 - 18:00:00 2:00:00 entry 2
+ 4:00:00
+4 Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 entry 3
+5 18:00:00 - 2:00:00 entry 4
+ 4:00:00
+ ---------------------------------------------------------
+ Total 8:00:00
OUTPUT
end
it "should display the current timesheet" do
Timetrap.current_sheet = 'SpecSheet'
@@ -181,13 +181,23 @@
invoke "kill #{entry.sheet}"
end.should_not change(Timetrap::Entry, :count).by(-1)
end
it "should delete a timesheet" do
+ create_entry
entry = create_entry
lambda do
$stdin.string = "yes\n"
invoke "kill #{entry.sheet}"
+ end.should change(Timetrap::Entry, :count).by(-2)
+ end
+
+ it "should delete an entry" do
+ create_entry
+ entry = create_entry
+ lambda do
+ $stdin.string = "yes\n"
+ invoke "kill --id #{entry.id}"
end.should change(Timetrap::Entry, :count).by(-1)
end
end
describe "list" do