WIP: need to finish up the backend still, some frontend is here for integration testing.
This commit is contained in:
1 parent
82dec74eb7
commit
394236c741
3 files changed
+38
-10
No files matched your search
@@ -5,9 +5,13 @@ class DeliverableDetailsShowTest < ActionController::IntegrationTest
|
||||
|
||||
def setup
|
||||
@project = Project.generate!(:identifier => 'main').reload
|
||||
@contract = Contract.generate!(:project => @project)
|
||||
@contract = Contract.generate!(:project => @project, :billable_rate => 10)
|
||||
@manager = User.generate!
|
||||
@deliverable1 = FixedDeliverable.generate!(:contract => @contract, :manager => @manager)
|
||||
@deliverable1 = RetainerDeliverable.spawn(:contract => @contract, :manager => @manager, :title => "Retainer", :start_date => '2010-01-01', :end_date => '2010-03-31')
|
||||
@deliverable1.labor_budgets << LaborBudget.spawn(:budget => 100, :hours => 10)
|
||||
@deliverable1.overhead_budgets << OverheadBudget.spawn(:budget => 200, :hours => 10)
|
||||
|
||||
@deliverable1.save!
|
||||
end
|
||||
|
||||
context "for a JS request" do
|
||||
@@ -21,5 +25,26 @@ class DeliverableDetailsShowTest < ActionController::IntegrationTest
|
||||
|
||||
end
|
||||
|
||||
should "filter the details based on the period" do
|
||||
assert_equal 300, @deliverable1.labor_budget_total
|
||||
assert_equal 600, @deliverable1.overhead_budget_total
|
||||
assert_equal 300, @deliverable1.total # Contract rate * 30 hours (labor)
|
||||
|
||||
visit "/projects/#{@project.id}/contracts/#{@contract.id}/deliverables/#{@deliverable1.id}", :get, {:format => 'js', :as => 'deliverable_details_row', :period => '2010-02'}
|
||||
|
||||
puts response.body
|
||||
assert_response :success
|
||||
assert_select ".deliverable_details_outer_wrapper_#{@deliverable1.id}" do
|
||||
assert_select "td.labor_budget_total", '100'
|
||||
assert_select "td.overhead_budget_total", '200'
|
||||
assert_select "td.total", '100'
|
||||
|
||||
assert_select "select.retainer_period_change" do
|
||||
assert_select "option[selected=selected]", "Feburary 2010"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user