[#4601] Change Manage Budget to a givable permission
This commit is contained in:
@@ -9,9 +9,30 @@ class ContractsEditTest < ActionController::IntegrationTest
|
||||
@role = Role.generate!
|
||||
User.add_to_project(@account_executive, @project, @role)
|
||||
@contract = Contract.generate!(:project => @project, :name => 'A Contract', :account_executive => @account_executive)
|
||||
@user = User.generate_user_with_permission_to_manage_budget(:project => @project)
|
||||
|
||||
login_as(@user.login, 'contracts')
|
||||
end
|
||||
|
||||
should "allow any user to edit the contract" do
|
||||
should "block anonymous users from editing the contract" do
|
||||
logout
|
||||
visit "/projects/#{@project.identifier}/contracts/#{@contract.id}/edit"
|
||||
|
||||
assert_requires_login
|
||||
end
|
||||
|
||||
should "block unauthorized users from editing the contract" do
|
||||
logout
|
||||
|
||||
@user = User.generate!(:password => 'test', :password_confirmation => 'test')
|
||||
login_as(@user.login, 'test')
|
||||
|
||||
visit "/projects/#{@project.identifier}/contracts/#{@contract.id}/edit"
|
||||
|
||||
assert_forbidden
|
||||
end
|
||||
|
||||
should "allow authorized users to edit the contract" do
|
||||
visit_contracts_for_project(@project)
|
||||
click_link @contract.id
|
||||
assert_response :success
|
||||
|
||||
Reference in New Issue
Block a user