summaryrefslogtreecommitdiff
path: root/spec/controllers/projects
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/compare_controller_spec.rb7
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb62
-rw-r--r--spec/controllers/projects/refs_controller_spec.rb17
3 files changed, 60 insertions, 26 deletions
diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb
index 23e1566b8f3..b643b354073 100644
--- a/spec/controllers/projects/compare_controller_spec.rb
+++ b/spec/controllers/projects/compare_controller_spec.rb
@@ -12,8 +12,11 @@ describe Projects::CompareController do
end
it 'compare should show some diffs' do
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, from: ref_from, to: ref_to)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ from: ref_from,
+ to: ref_to)
expect(response).to be_success
expect(assigns(:diffs).length).to be >= 1
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index 5cc5bd78cd7..bda931666f7 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -13,8 +13,11 @@ describe Projects::MergeRequestsController do
describe "#show" do
shared_examples "export merge as" do |format|
it "should generally work" do
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format)
expect(response).to be_success
end
@@ -22,13 +25,19 @@ describe Projects::MergeRequestsController do
it "should generate it" do
expect_any_instance_of(MergeRequest).to receive(:"to_#{format}")
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format)
end
it "should render it" do
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format)
expect(response.body).to eq((merge_request.send(:"to_#{format}",user)).to_s)
end
@@ -37,8 +46,11 @@ describe Projects::MergeRequestsController do
allow_any_instance_of(MergeRequest).to receive(:"to_#{format}").
and_return('HTML entities &<>" ')
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format)
expect(response.body).to_not include('&amp;')
expect(response.body).to_not include('&gt;')
@@ -52,8 +64,11 @@ describe Projects::MergeRequestsController do
let(:format) { :diff }
it "should really only be a git diff" do
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format)
expect(response.body).to start_with("diff --git")
end
@@ -64,15 +79,20 @@ describe Projects::MergeRequestsController do
let(:format) { :patch }
it "should really be a git email patch with commit" do
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid, format: format)
expect(response.body[0..100]).to start_with("From #{merge_request.commits.last.id}")
end
it "should contain git diffs" do
- get(:show, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format)
+ get(:show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format)
expect(response.body).to match(/^diff --git/)
end
@@ -81,8 +101,11 @@ describe Projects::MergeRequestsController do
describe 'GET diffs' do
def go(format: 'html')
- get :diffs, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format
+ get :diffs,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format
end
context 'as html' do
@@ -126,8 +149,11 @@ describe Projects::MergeRequestsController do
describe 'GET commits' do
def go(format: 'html')
- get :commits, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: merge_request.iid, format: format
+ get :commits,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.iid,
+ format: format
end
context 'as html' do
diff --git a/spec/controllers/projects/refs_controller_spec.rb b/spec/controllers/projects/refs_controller_spec.rb
index c254ab7cb6e..abd45a74e2d 100644
--- a/spec/controllers/projects/refs_controller_spec.rb
+++ b/spec/controllers/projects/refs_controller_spec.rb
@@ -11,15 +11,20 @@ describe Projects::RefsController do
describe 'GET #logs_tree' do
def default_get(format = :html)
- get :logs_tree, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: 'master',
- path: 'foo/bar/baz.html', format: format
+ get :logs_tree,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: 'master',
+ path: 'foo/bar/baz.html',
+ format: format
end
def xhr_get(format = :html)
- xhr :get, :logs_tree, namespace_id: project.namespace.to_param,
- project_id: project.to_param, id: 'master',
- path: 'foo/bar/baz.html', format: format
+ xhr :get,
+ :logs_tree,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param, id: 'master',
+ path: 'foo/bar/baz.html', format: format
end
it 'never throws MissingTemplate' do