summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/controllers/blob_controller_spec.rb5
-rw-r--r--spec/controllers/branches_controller_spec.rb14
-rw-r--r--spec/controllers/commit_controller_spec.rb3
-rw-r--r--spec/controllers/import/github_controller_spec.rb12
-rw-r--r--spec/controllers/import/gitlab_controller_spec.rb9
-rw-r--r--spec/controllers/merge_requests_controller_spec.rb3
6 files changed, 31 insertions, 15 deletions
diff --git a/spec/controllers/blob_controller_spec.rb b/spec/controllers/blob_controller_spec.rb
index 02f418053fa..02a9db61255 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 d31870058ca..0c39d016440 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 507fd4e6ba7..8f0d0261e6d 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 30bf54a908c..69469e5d8f3 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 322dec04a1e..287aa315db5 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 fde34e480bf..eedaf17941a 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