diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-05-15 10:51:44 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-05-15 10:51:44 +0300 |
commit | 6fcc731e52cee1e8a6c264f526da8da5e455e407 (patch) | |
tree | b8665dae36c42d48fa7f53b1692e881006807cd1 /spec | |
parent | da8c9887459f53401ff575ad49de54c05963cb2c (diff) | |
download | gitlab-ci-6fcc731e52cee1e8a6c264f526da8da5e455e407.tar.gz |
public accessible build and commit
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/projects.rb | 10 | ||||
-rw-r--r-- | spec/features/builds_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/commits_spec.rb | 43 |
3 files changed, 54 insertions, 15 deletions
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 95f43f8..6df53f2 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -33,21 +33,25 @@ FactoryGirl.define do end default_ref 'master' - + sequence :path do |n| "gitlab/gitlab-shell#{n}" end - + sequence :ssh_url_to_repo do |n| "git@demo.gitlab.com:gitlab/gitlab-shell#{n}.git" end - + gitlab_id 8 factory :project do token 'iPWx6WM4lhHNedGfBpPJNP' end + factory :public_project do + public true + end + before :create do |project| project.build_default_job end diff --git a/spec/features/builds_spec.rb b/spec/features/builds_spec.rb index 91ac95a..d8ad0ce 100644 --- a/spec/features/builds_spec.rb +++ b/spec/features/builds_spec.rb @@ -2,7 +2,6 @@ require 'spec_helper' describe "Builds" do before do - login_as :user @project = FactoryGirl.create :project @commit = FactoryGirl.create :commit, project: @project @build = FactoryGirl.create :build, commit: @commit @@ -10,6 +9,7 @@ describe "Builds" do describe "GET /:project/builds/:id" do before do + login_as :user visit project_build_path(@project, @build) end @@ -20,6 +20,7 @@ describe "Builds" do describe "GET /:project/builds/:id/cancel" do before do + login_as :user @build.run! visit cancel_project_build_path(@project, @build) end @@ -30,6 +31,7 @@ describe "Builds" do describe "POST /:project/builds/:id/retry" do before do + login_as :user @build.cancel! visit project_build_path(@project, @build) click_link 'Retry' @@ -38,4 +40,16 @@ describe "Builds" do it { page.should have_content 'pending' } it { page.should have_content 'Cancel' } end + + describe "Show page public accessible" do + before do + @project = FactoryGirl.create :public_project + @commit = FactoryGirl.create :commit, project: @project + @build = FactoryGirl.create :build, commit: @commit + stub_gitlab_calls + visit project_build_path(@project, @build) + end + + it { page.should have_content @commit.sha[0..7] } + end end diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 01d5eef..2108d2c 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -1,21 +1,42 @@ require 'spec_helper' describe "Commits" do - before do - login_as :user - @project = FactoryGirl.create :project - @commit = FactoryGirl.create :commit, project: @project - @job = FactoryGirl.create :job, project: @project - @build = FactoryGirl.create :build, commit: @commit, job: @job + context "Authenticated user" do + before do + login_as :user + @project = FactoryGirl.create :project + @commit = FactoryGirl.create :commit, project: @project + @job = FactoryGirl.create :job, project: @project + @build = FactoryGirl.create :build, commit: @commit, job: @job + end + + describe "GET /:project/commits/:sha" do + before do + visit project_ref_commit_path(@project, @commit.ref, @commit.sha) + end + + it { page.should have_content @commit.sha[0..7] } + it { page.should have_content @commit.git_commit_message } + it { page.should have_content @commit.git_author_name } + end end - describe "GET /:project/commits/:sha" do + context "Public pages" do before do - visit project_ref_commit_path(@project, @commit.ref, @commit.sha) + @project = FactoryGirl.create :public_project + @commit = FactoryGirl.create :commit, project: @project + @job = FactoryGirl.create :job, project: @project + @build = FactoryGirl.create :build, commit: @commit, job: @job end - it { page.should have_content @commit.sha[0..7] } - it { page.should have_content @commit.git_commit_message } - it { page.should have_content @commit.git_author_name } + describe "GET /:project/commits/:sha" do + before do + visit project_ref_commit_path(@project, @commit.ref, @commit.sha) + end + + it { page.should have_content @commit.sha[0..7] } + it { page.should have_content @commit.git_commit_message } + it { page.should have_content @commit.git_author_name } + end end end |