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
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
......@@ -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
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
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