[#4177] Scope the finders on ContractsController to use the current project.

This commit is contained in:
Eric Davis
2010-06-17 16:02:31 -07:00
parent 736f315b36
commit 793fe165c1
3 changed files with 32 additions and 10 deletions
+22 -6
View File
@@ -4,9 +4,18 @@ class ContractsListTest < ActionController::IntegrationTest
include Redmine::I18n
def setup
@project = Project.generate!
@project = Project.generate!(:identifier => 'main')
@contract = Contract.generate!(:project => @project)
@contract2 = Contract.generate!(:project => @project)
@other_project = Project.generate!(:identifier => 'other')
@other_contract = Contract.generate!(:project => @other_project)
[@project,
@other_project,
@contract,
@contract2,
@other_contract
].map {|c| c.reload }
end
should "allow any user to list the contracts on a project" do
@@ -18,15 +27,22 @@ class ContractsListTest < ActionController::IntegrationTest
assert_select "table#contracts" do
[@contract, @contract2].each do |contract|
assert_select "td", :text => /#{contract.id}/
assert_select "td", :text => /#{contract.name}/
assert_select "td", :text => /#{contract.account_executive.name}/
assert_select "td", :text => /#{format_date(contract.end_date)}/
assert_select "td.id", :text => /#{contract.id}/
assert_select "td.name", :text => /#{contract.name}/
assert_select "td.account-executive", :text => /#{contract.account_executive.name}/
assert_select "td.end-date", :text => /#{format_date(contract.end_date)}/
end
end
end
should "not list contracts from other projects"
should "not list contracts from other projects" do
visit_contracts_for_project(@project)
assert_select "table#contracts" do
assert_select "td", :text => /#{@other_contract.name}/, :count => 0
end
end
end