diff options
Diffstat (limited to 'spec/controllers/search_controller_spec.rb')
-rw-r--r-- | spec/controllers/search_controller_spec.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb index 02a0cfe0272..50504566502 100644 --- a/spec/controllers/search_controller_spec.rb +++ b/spec/controllers/search_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require "spec_helper" describe SearchController do let(:user) { create(:user) } @@ -7,43 +7,43 @@ describe SearchController do sign_in(user) end - it 'finds issue comments' do + it "finds issue comments" do project = create(:project, :public) note = create(:note_on_issue, project: project) - get :show, params: { project_id: project.id, scope: 'notes', search: note.note } + get :show, params: {project_id: project.id, scope: "notes", search: note.note} expect(assigns[:search_objects].first).to eq note end - context 'when the user cannot read cross project' do + context "when the user cannot read cross project" do before do allow(Ability).to receive(:allowed?).and_call_original allow(Ability).to receive(:allowed?) - .with(user, :read_cross_project, :global) { false } + .with(user, :read_cross_project, :global) { false } end - it 'still allows accessing the search page' do + it "still allows accessing the search page" do get :show expect(response).to have_gitlab_http_status(200) end - it 'still blocks searches without a project_id' do - get :show, params: { search: 'hello' } + it "still blocks searches without a project_id" do + get :show, params: {search: "hello"} expect(response).to have_gitlab_http_status(403) end - it 'allows searches with a project_id' do - get :show, params: { search: 'hello', project_id: create(:project, :public).id } + it "allows searches with a project_id" do + get :show, params: {search: "hello", project_id: create(:project, :public).id} expect(response).to have_gitlab_http_status(200) end end - context 'on restricted projects' do - context 'when signed out' do + context "on restricted projects" do + context "when signed out" do before do sign_out(user) end @@ -52,7 +52,7 @@ describe SearchController do project = create(:project, :public, :issues_private) note = create(:note_on_issue, project: project) - get :show, params: { project_id: project.id, scope: 'notes', search: note.note } + get :show, params: {project_id: project.id, scope: "notes", search: note.note} expect(assigns[:search_objects].count).to eq(0) end @@ -62,7 +62,7 @@ describe SearchController do project = create(:project, :public, :merge_requests_private) note = create(:note_on_merge_request, project: project) - get :show, params: { project_id: project.id, scope: 'notes', search: note.note } + get :show, params: {project_id: project.id, scope: "notes", search: note.note} expect(assigns[:search_objects].count).to eq(0) end @@ -71,7 +71,7 @@ describe SearchController do project = create(:project, :public, :snippets_private) note = create(:note_on_project_snippet, project: project) - get :show, params: { project_id: project.id, scope: 'notes', search: note.note } + get :show, params: {project_id: project.id, scope: "notes", search: note.note} expect(assigns[:search_objects].count).to eq(0) end |