summaryrefslogtreecommitdiff
path: root/spec/controllers/projects_controller_spec.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-06-20 11:37:27 +0100
committerPhil Hughes <me@iamphill.com>2016-06-20 11:37:27 +0100
commitf112e2a1da696905e994bf5c37c10a950779b1a9 (patch)
treed4b42a4b7c959bf6b742fd7e87b76f4a3d7493dd /spec/controllers/projects_controller_spec.rb
parentc240cad59a84e090e12d7ce6db94983405aa1813 (diff)
downloadgitlab-ce-f112e2a1da696905e994bf5c37c10a950779b1a9.tar.gz
Fixed issue with returning ref in commits JSONasync-refs-dropdown
Added tests to project controller
Diffstat (limited to 'spec/controllers/projects_controller_spec.rb')
-rw-r--r--spec/controllers/projects_controller_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index fba545560c7..146b2c2e131 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -237,4 +237,24 @@ describe ProjectsController do
expect(response.status).to eq(401)
end
end
+
+ describe "GET refs" do
+ it "should get a list of branches and tags" do
+ get :refs, namespace_id: public_project.namespace.path, id: public_project.path
+
+ parsed_body = JSON.parse(response.body)
+ expect(parsed_body["Branches"]).to include("master")
+ expect(parsed_body["Tags"]).to include("v1.0.0")
+ expect(parsed_body["Commits"]).to be_nil
+ end
+
+ it "should get a list of branches, tags and commits" do
+ get :refs, namespace_id: public_project.namespace.path, id: public_project.path, ref: "123456"
+
+ parsed_body = JSON.parse(response.body)
+ expect(parsed_body["Branches"]).to include("master")
+ expect(parsed_body["Tags"]).to include("v1.0.0")
+ expect(parsed_body["Commits"]).to include("123456")
+ end
+ end
end