Commit 4df61428 authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Mock with specific project instance

parent ae5a198e
...@@ -20,7 +20,7 @@ RSpec.describe Projects::Security::VulnerabilitiesController do ...@@ -20,7 +20,7 @@ RSpec.describe Projects::Security::VulnerabilitiesController do
before do before do
allow(controller).to receive(:can?).and_call_original allow(controller).to receive(:can?).and_call_original
allow(controller).to receive(:can?).with(controller.current_user, :create_vulnerability, an_instance_of(Project)).and_return(can_create_vulnerability) allow(controller).to receive(:can?).with(controller.current_user, :create_vulnerability, project).and_return(can_create_vulnerability)
end end
include_context '"Security & Compliance" permissions' do include_context '"Security & Compliance" permissions' do
...@@ -31,7 +31,7 @@ RSpec.describe Projects::Security::VulnerabilitiesController do ...@@ -31,7 +31,7 @@ RSpec.describe Projects::Security::VulnerabilitiesController do
it 'checks if the user can create a vulnerability' do it 'checks if the user can create a vulnerability' do
request_new_vulnerability_page request_new_vulnerability_page
expect(controller).to have_received(:can?).with(controller.current_user, :create_vulnerability, an_instance_of(Project)) expect(controller).to have_received(:can?).with(controller.current_user, :create_vulnerability, project)
end end
context 'when user can create vulnerability' do context 'when user can create vulnerability' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment