From b9e68cd52c5f9c5835508bb6ee5312b1a3253ec0 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 7 Jul 2010 13:29:20 -0700 Subject: [PATCH] [#4182] Added test for Deliverable#overhead_spent integration. --- .../overhead_plugin_integration_test.rb | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/test/integration/overhead_plugin_integration_test.rb b/test/integration/overhead_plugin_integration_test.rb index 067140f..4e39211 100644 --- a/test/integration/overhead_plugin_integration_test.rb +++ b/test/integration/overhead_plugin_integration_test.rb @@ -15,7 +15,33 @@ class OverheadPluginIntegrationTest < ActionController::IntegrationTest context "Patches to Deliverable" do context "#overhead_spent" do - should "return the total cost for all of the time on the issues for non-billable activities" + should "return the total cost for all of the time on the issues for non-billable activities" do + @issue1 = Issue.generate_for_project!(@project) + @time_entry1 = TimeEntry.generate!(:issue => @issue1, + :project => @project, + :activity => @billable_activity, + :spent_on => Date.today, + :hours => 10, + :user => @manager) + @time_entry2 = TimeEntry.generate!(:issue => @issue1, + :project => @project, + :activity => @non_billable_activity, + :spent_on => Date.today, + :hours => 20, + :user => @manager) + + @rate = Rate.generate!(:project => @project, + :user => @manager, + :date_in_effect => Date.yesterday, + :amount => 100) + + @hourly_deliverable.issues << @issue1 + + assert_equal 1, @hourly_deliverable.issues.count + + assert_equal 20 * 100, @hourly_deliverable.overhead_spent + + end end end @@ -40,7 +66,7 @@ class OverheadPluginIntegrationTest < ActionController::IntegrationTest :project => @project, :activity => @non_billable_activity, :spent_on => Date.today, - :hours => 10, + :hours => 20, :user => @manager) @rate = Rate.generate!(:project => @project, @@ -78,7 +104,7 @@ class OverheadPluginIntegrationTest < ActionController::IntegrationTest :project => @project, :activity => @non_billable_activity, :spent_on => Date.today, - :hours => 10, + :hours => 20, :user => @manager) @rate = Rate.generate!(:project => @project,