diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2018-03-27 20:39:18 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2018-03-27 20:39:18 +0300 |
commit | de0c4730bb83b94195678e5ad4865ea648e6585f (patch) | |
tree | 3ea0fd48c5736b0f5b328f117c3db0508a371d22 /spec/features/commits_spec.rb | |
parent | dc5b5130d573a48fc34fa62862a1ad6da776b0d0 (diff) | |
parent | a1cde68d208437a470267e28ccff66fe8be88c2e (diff) |
Merge branch 'master' into add-canary-favicon
Diffstat (limited to 'spec/features/commits_spec.rb')
-rw-r--r-- | spec/features/commits_spec.rb | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 0373f649ee8..62a2ec55b00 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' describe 'Commits' do - include CiStatusHelper - let(:project) { create(:project, :repository) } let(:user) { create(:user) } @@ -28,12 +26,12 @@ describe 'Commits' do let!(:status) { create(:generic_commit_status, pipeline: pipeline) } before do - project.team << [user, :reporter] + project.add_reporter(user) end describe 'Commit builds' do before do - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) end it { expect(page).to have_content pipeline.sha[0..7] } @@ -53,7 +51,7 @@ describe 'Commits' do context 'when logged as developer' do before do - project.team << [user, :developer] + project.add_developer(user) end describe 'Project commits' do @@ -66,7 +64,7 @@ describe 'Commits' do end before do - visit namespace_project_commits_path(project.namespace, project, :master) + visit project_commits_path(project, :master) end it 'shows correct build status from default branch' do @@ -77,9 +75,9 @@ describe 'Commits' do end end - describe 'Commit builds', :feature, :js do + describe 'Commit builds', :js do before do - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) end it 'shows pipeline`s data' do @@ -91,11 +89,11 @@ describe 'Commits' do context 'Download artifacts' do before do - build.update_attributes(artifacts_file: artifacts_file) + build.update_attributes(legacy_artifacts_file: artifacts_file) end it do - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) click_on 'Download artifacts' expect(page.response_headers['Content-Type']).to eq(artifacts_file.content_type) end @@ -103,7 +101,7 @@ describe 'Commits' do describe 'Cancel all builds' do it 'cancels commit', :js do - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) click_on 'Cancel running' expect(page).to have_content 'canceled' end @@ -111,7 +109,7 @@ describe 'Commits' do describe 'Cancel build' do it 'cancels build', :js do - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) find('.js-btn-cancel-pipeline').click expect(page).to have_content 'canceled' end @@ -120,13 +118,13 @@ describe 'Commits' do describe '.gitlab-ci.yml not found warning' do context 'ci builds enabled' do it "does not show warning" do - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) expect(page).not_to have_content '.gitlab-ci.yml not found in this commit' end it 'shows warning' do stub_ci_pipeline_yaml_file(nil) - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) expect(page).to have_content '.gitlab-ci.yml not found in this commit' end end @@ -135,7 +133,7 @@ describe 'Commits' do before do stub_ci_builds_disabled stub_ci_pipeline_yaml_file(nil) - visit ci_status_path(pipeline) + visit pipeline_path(pipeline) end it 'does not show warning' do @@ -147,12 +145,12 @@ describe 'Commits' do context "when logged as reporter" do before do - project.team << [user, :reporter] - build.update_attributes(artifacts_file: artifacts_file) - visit ci_status_path(pipeline) + project.add_reporter(user) + build.update_attributes(legacy_artifacts_file: artifacts_file) + visit pipeline_path(pipeline) end - it 'Renders header', :feature, :js do + it 'Renders header', :js do expect(page).to have_content pipeline.sha[0..7] expect(page).to have_content pipeline.git_commit_message expect(page).to have_content pipeline.user.name @@ -165,13 +163,13 @@ describe 'Commits' do end end - context 'when accessing internal project with disallowed access', :feature, :js do + context 'when accessing internal project with disallowed access', :js do before do project.update( visibility_level: Gitlab::VisibilityLevel::INTERNAL, public_builds: false) - build.update_attributes(artifacts_file: artifacts_file) - visit ci_status_path(pipeline) + build.update_attributes(legacy_artifacts_file: artifacts_file) + visit pipeline_path(pipeline) end it do @@ -190,17 +188,24 @@ describe 'Commits' do let(:branch_name) { 'master' } before do - project.team << [user, :master] + project.add_master(user) sign_in(user) - visit namespace_project_commits_path(project.namespace, project, branch_name) + visit project_commits_path(project, branch_name) end it 'includes the committed_date for each commit' do - commits = project.repository.commits(branch_name) + commits = project.repository.commits(branch_name, limit: 40) commits.each do |commit| - expect(page).to have_content("committed #{commit.committed_date.strftime("%b %d, %Y")}") + expect(page).to have_content("authored #{commit.authored_date.strftime("%b %d, %Y")}") end end + + it 'shows the ref switcher with the multi-file editor enabled', :js do + set_cookie('new_repo', 'true') + visit project_commits_path(project, branch_name) + + expect(find('.js-project-refs-dropdown')).to have_content branch_name + end end end |