Commit 940a402b authored by Jeroen van Baarsen's avatar Jeroen van Baarsen

Fixed hound warnings

Signed-off-by: default avatarJeroen van Baarsen <jeroenvanbaarsen@gmail.com>
parent 0c4a70a3
...@@ -45,7 +45,10 @@ describe Projects::BlobController do ...@@ -45,7 +45,10 @@ describe Projects::BlobController do
context 'redirect to tree' do context 'redirect to tree' do
let(:id) { 'markdown/doc' } 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 end
end end
...@@ -27,25 +27,31 @@ describe Projects::BranchesController do ...@@ -27,25 +27,31 @@ describe Projects::BranchesController do
context "valid branch name, valid source" do context "valid branch name, valid source" do
let(:branch) { "merge_branch" } let(:branch) { "merge_branch" }
let(:ref) { "master" } 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 end
context "invalid branch name, valid ref" do context "invalid branch name, valid ref" do
let(:branch) { "<script>alert('merge');</script>" } let(:branch) { "<script>alert('merge');</script>" }
let(:ref) { "master" } 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 end
context "valid branch name, invalid ref" do context "valid branch name, invalid ref" do
let(:branch) { "merge_branch" } let(:branch) { "merge_branch" }
let(:ref) { "<script>alert('ref');</script>" } let(:ref) { "<script>alert('ref');</script>" }
it { is_expected.to render_template("new") } it { is_expected.to render_template('new') }
end end
context "invalid branch name, invalid ref" do context "invalid branch name, invalid ref" do
let(:branch) { "<script>alert('merge');</script>" } let(:branch) { "<script>alert('merge');</script>" }
let(:ref) { "<script>alert('ref');</script>" } let(:ref) { "<script>alert('ref');</script>" }
it { is_expected.to render_template("new") } it { is_expected.to render_template('new') }
end end
end end
end end
...@@ -31,7 +31,8 @@ describe Projects::CommitController do ...@@ -31,7 +31,8 @@ describe Projects::CommitController do
end end
it "should not escape Html" do 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 get :show, project_id: project.to_param, id: commit.id, format: format
......
...@@ -10,8 +10,11 @@ describe Import::GithubController do ...@@ -10,8 +10,11 @@ describe Import::GithubController do
describe "GET callback" do describe "GET callback" do
it "updates access token" do it "updates access token" do
token = "asdasd12345" token = "asdasd12345"
allow_any_instance_of(Gitlab::GithubImport::Client).to receive(:get_token).and_return(token) allow_any_instance_of(Gitlab::GithubImport::Client).
Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github") to receive(:get_token).and_return(token)
Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123",
app_secret: "asd123",
name: "github")
get :callback get :callback
...@@ -55,7 +58,8 @@ describe Import::GithubController do ...@@ -55,7 +58,8 @@ describe Import::GithubController do
it "takes already existing namespace" do it "takes already existing namespace" do
namespace = create(:namespace, name: "john", owner: user) 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)) and_return(double(execute: true))
controller.stub_chain(:client, :repo).and_return(@repo) controller.stub_chain(:client, :repo).and_return(@repo)
......
...@@ -58,7 +58,8 @@ describe Import::GitlabController do ...@@ -58,7 +58,8 @@ describe Import::GitlabController do
it "takes already existing namespace" do it "takes already existing namespace" do
namespace = create(:namespace, name: "john", owner: user) 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)) and_return(double(execute: true))
controller.stub_chain(:client, :project).and_return(@repo) controller.stub_chain(:client, :project).and_return(@repo)
......
...@@ -31,7 +31,8 @@ describe Projects::MergeRequestsController do ...@@ -31,7 +31,8 @@ describe Projects::MergeRequestsController do
end end
it "should not escape Html" do 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 get :show, project_id: project.to_param, id: merge_request.iid, format: format
......
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