From 940a402b6e015cde1b3513808cb9ac7f0a3bec8c Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> Date: Thu, 12 Feb 2015 19:32:58 +0100 Subject: [PATCH] Fixed hound warnings Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> --- spec/controllers/blob_controller_spec.rb | 5 ++++- spec/controllers/branches_controller_spec.rb | 14 ++++++++++---- spec/controllers/commit_controller_spec.rb | 3 ++- spec/controllers/import/github_controller_spec.rb | 12 ++++++++---- spec/controllers/import/gitlab_controller_spec.rb | 9 +++++---- spec/controllers/merge_requests_controller_spec.rb | 3 ++- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/spec/controllers/blob_controller_spec.rb b/spec/controllers/blob_controller_spec.rb index 02f418053..02a9db612 100644 --- a/spec/controllers/blob_controller_spec.rb +++ b/spec/controllers/blob_controller_spec.rb @@ -45,7 +45,10 @@ describe Projects::BlobController do context 'redirect to tree' do let(:id) { 'markdown/doc' } - it { is_expected.to redirect_to("/#{project.path_with_namespace}/tree/markdown/doc") } + it "redirects" do + expect(subject). + to redirect_to("/#{project.path_with_namespace}/tree/markdown/doc") + end end end end diff --git a/spec/controllers/branches_controller_spec.rb b/spec/controllers/branches_controller_spec.rb index d31870058..0c39d0164 100644 --- a/spec/controllers/branches_controller_spec.rb +++ b/spec/controllers/branches_controller_spec.rb @@ -27,25 +27,31 @@ describe Projects::BranchesController do context "valid branch name, valid source" do let(:branch) { "merge_branch" } let(:ref) { "master" } - it { is_expected.to redirect_to("/#{project.path_with_namespace}/tree/merge_branch") } + it 'redirects' do + expect(subject). + to redirect_to("/#{project.path_with_namespace}/tree/merge_branch") + end end context "invalid branch name, valid ref" do let(:branch) { "<script>alert('merge');</script>" } let(:ref) { "master" } - it { is_expected.to redirect_to("/#{project.path_with_namespace}/tree/alert('merge');") } + it 'redirects' do + expect(subject). + to redirect_to("/#{project.path_with_namespace}/tree/alert('merge');") + end end context "valid branch name, invalid ref" do let(:branch) { "merge_branch" } let(:ref) { "<script>alert('ref');</script>" } - it { is_expected.to render_template("new") } + it { is_expected.to render_template('new') } end context "invalid branch name, invalid ref" do let(:branch) { "<script>alert('merge');</script>" } let(:ref) { "<script>alert('ref');</script>" } - it { is_expected.to render_template("new") } + it { is_expected.to render_template('new') } end end end diff --git a/spec/controllers/commit_controller_spec.rb b/spec/controllers/commit_controller_spec.rb index 507fd4e6b..8f0d0261e 100644 --- a/spec/controllers/commit_controller_spec.rb +++ b/spec/controllers/commit_controller_spec.rb @@ -31,7 +31,8 @@ describe Projects::CommitController do end it "should not escape Html" do - allow_any_instance_of(Commit).to receive(:"to_#{format}").and_return('HTML entities &<>" ') + allow_any_instance_of(Commit).to receive(:"to_#{format}") + .and_return('HTML entities &<>" ') get :show, project_id: project.to_param, id: commit.id, format: format diff --git a/spec/controllers/import/github_controller_spec.rb b/spec/controllers/import/github_controller_spec.rb index 30bf54a90..69469e5d8 100644 --- a/spec/controllers/import/github_controller_spec.rb +++ b/spec/controllers/import/github_controller_spec.rb @@ -10,11 +10,14 @@ describe Import::GithubController do describe "GET callback" do it "updates access token" do token = "asdasd12345" - allow_any_instance_of(Gitlab::GithubImport::Client).to receive(:get_token).and_return(token) - Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github") + allow_any_instance_of(Gitlab::GithubImport::Client). + to receive(:get_token).and_return(token) + Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", + app_secret: "asd123", + name: "github") get :callback - + expect(user.reload.github_access_token).to eq(token) expect(controller).to redirect_to(status_import_github_url) end @@ -55,7 +58,8 @@ describe Import::GithubController do it "takes already existing namespace" do namespace = create(:namespace, name: "john", owner: user) - expect(Gitlab::GithubImport::ProjectCreator).to receive(:new).with(@repo, namespace, user). + expect(Gitlab::GithubImport::ProjectCreator). + to receive(:new).with(@repo, namespace, user). and_return(double(execute: true)) controller.stub_chain(:client, :repo).and_return(@repo) diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb index 322dec04a..287aa315d 100644 --- a/spec/controllers/import/gitlab_controller_spec.rb +++ b/spec/controllers/import/gitlab_controller_spec.rb @@ -14,7 +14,7 @@ describe Import::GitlabController do Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "gitlab") get :callback - + expect(user.reload.gitlab_access_token).to eq(token) expect(controller).to redirect_to(status_import_gitlab_url) end @@ -28,7 +28,7 @@ describe Import::GitlabController do it "assigns variables" do @project = create(:project, import_type: 'gitlab', creator_id: user.id) controller.stub_chain(:client, :projects).and_return([@repo]) - + get :status expect(assigns(:already_added_projects)).to eq([@project]) @@ -38,7 +38,7 @@ describe Import::GitlabController do it "does not show already added project" do @project = create(:project, import_type: 'gitlab', creator_id: user.id, import_source: 'asd/vim') controller.stub_chain(:client, :projects).and_return([@repo]) - + get :status expect(assigns(:already_added_projects)).to eq([@project]) @@ -58,7 +58,8 @@ describe Import::GitlabController do it "takes already existing namespace" do namespace = create(:namespace, name: "john", owner: user) - expect(Gitlab::GitlabImport::ProjectCreator).to receive(:new).with(@repo, namespace, user). + expect(Gitlab::GitlabImport::ProjectCreator). + to receive(:new).with(@repo, namespace, user). and_return(double(execute: true)) controller.stub_chain(:client, :project).and_return(@repo) diff --git a/spec/controllers/merge_requests_controller_spec.rb b/spec/controllers/merge_requests_controller_spec.rb index fde34e480..eedaf1794 100644 --- a/spec/controllers/merge_requests_controller_spec.rb +++ b/spec/controllers/merge_requests_controller_spec.rb @@ -31,7 +31,8 @@ describe Projects::MergeRequestsController do end it "should not escape Html" do - allow_any_instance_of(MergeRequest).to receive(:"to_#{format}").and_return('HTML entities &<>" ') + allow_any_instance_of(MergeRequest).to receive(:"to_#{format}"). + and_return('HTML entities &<>" ') get :show, project_id: project.to_param, id: merge_request.iid, format: format -- 2.30.9