diff options
Diffstat (limited to 'spec/features/cycle_analytics_spec.rb')
-rw-r--r-- | spec/features/cycle_analytics_spec.rb | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb index f4b2b9033ab..f8fddd6e31e 100644 --- a/spec/features/cycle_analytics_spec.rb +++ b/spec/features/cycle_analytics_spec.rb @@ -1,16 +1,16 @@ -require 'spec_helper' +require "spec_helper" -describe 'Cycle Analytics', :js do +describe "Cycle Analytics", :js do let(:user) { create(:user) } let(:guest) { create(:user) } let(:project) { create(:project, :repository) } let(:issue) { create(:issue, project: project, created_at: 2.days.ago) } let(:milestone) { create(:milestone, project: project) } let(:mr) { create_merge_request_closing_issue(user, project, issue, commit_message: "References #{issue.to_reference}") } - let(:pipeline) { create(:ci_empty_pipeline, status: 'created', project: project, ref: mr.source_branch, sha: mr.source_branch_sha, head_pipeline_of: mr) } + let(:pipeline) { create(:ci_empty_pipeline, status: "created", project: project, ref: mr.source_branch, sha: mr.source_branch_sha, head_pipeline_of: mr) } - context 'as an allowed user' do - context 'when project is new' do + context "as an allowed user" do + context "when project is new" do before do project.add_maintainer(user) @@ -20,18 +20,18 @@ describe 'Cycle Analytics', :js do wait_for_requests end - it 'shows introductory message' do - expect(page).to have_content('Introducing Cycle Analytics') + it "shows introductory message" do + expect(page).to have_content("Introducing Cycle Analytics") end - it 'shows pipeline summary' do - expect(new_issues_counter).to have_content('-') - expect(commits_counter).to have_content('-') - expect(deploys_counter).to have_content('-') + it "shows pipeline summary" do + expect(new_issues_counter).to have_content("-") + expect(commits_counter).to have_content("-") + expect(deploys_counter).to have_content("-") end - it 'shows active stage with empty message' do - expect(page).to have_selector('.stage-nav-item.active', text: 'Issue') + it "shows active stage with empty message" do + expect(page).to have_selector(".stage-nav-item.active", text: "Issue") expect(page).to have_content("We don't have enough data to show this stage.") end end @@ -48,31 +48,31 @@ describe 'Cycle Analytics', :js do visit project_cycle_analytics_path(project) end - it 'shows pipeline summary' do - expect(new_issues_counter).to have_content('1') - expect(commits_counter).to have_content('2') - expect(deploys_counter).to have_content('1') + it "shows pipeline summary" do + expect(new_issues_counter).to have_content("1") + expect(commits_counter).to have_content("2") + expect(deploys_counter).to have_content("1") end - it 'shows data on each stage' do + it "shows data on each stage" do expect_issue_to_be_present - click_stage('Plan') - expect(find('.stage-events')).to have_content(mr.commits.last.title) + click_stage("Plan") + expect(find(".stage-events")).to have_content(mr.commits.last.title) - click_stage('Code') + click_stage("Code") expect_merge_request_to_be_present - click_stage('Test') + click_stage("Test") expect_build_to_be_present - click_stage('Review') + click_stage("Review") expect_merge_request_to_be_present - click_stage('Staging') + click_stage("Staging") expect_build_to_be_present - click_stage('Production') + click_stage("Production") expect_issue_to_be_present end @@ -80,20 +80,20 @@ describe 'Cycle Analytics', :js do before do _two_weeks_old_issue = create(:issue, project: project, created_at: 2.weeks.ago) - click_button('Last 30 days') - click_link('Last 7 days') + click_button("Last 30 days") + click_link("Last 7 days") wait_for_requests end - it 'shows only relevant data' do - expect(new_issues_counter).to have_content('1') + it "shows only relevant data" do + expect(new_issues_counter).to have_content("1") end end end context "when my preferred language is Spanish" do before do - user.update_attribute(:preferred_language, 'es') + user.update_attribute(:preferred_language, "es") project.add_maintainer(user) sign_in(user) @@ -101,11 +101,11 @@ describe 'Cycle Analytics', :js do wait_for_requests end - it 'shows the content in Spanish' do - expect(page).to have_content('Estado del Pipeline') + it "shows the content in Spanish" do + expect(page).to have_content("Estado del Pipeline") end - it 'resets the language to English' do + it "resets the language to English" do expect(I18n.locale).to eq(:en) end end @@ -125,14 +125,14 @@ describe 'Cycle Analytics', :js do wait_for_requests end - it 'needs permissions to see restricted stages' do - expect(find('.stage-events')).to have_content(issue.title) + it "needs permissions to see restricted stages" do + expect(find(".stage-events")).to have_content(issue.title) - click_stage('Code') - expect(find('.stage-events')).to have_content('You need permission.') + click_stage("Code") + expect(find(".stage-events")).to have_content("You need permission.") - click_stage('Review') - expect(find('.stage-events')).to have_content('You need permission.') + click_stage("Review") + expect(find(".stage-events")).to have_content("You need permission.") end end @@ -149,25 +149,25 @@ describe 'Cycle Analytics', :js do end def expect_issue_to_be_present - expect(find('.stage-events')).to have_content(issue.title) - expect(find('.stage-events')).to have_content(issue.author.name) - expect(find('.stage-events')).to have_content("##{issue.iid}") + expect(find(".stage-events")).to have_content(issue.title) + expect(find(".stage-events")).to have_content(issue.author.name) + expect(find(".stage-events")).to have_content("##{issue.iid}") end def expect_build_to_be_present - expect(find('.stage-events')).to have_content(@build.ref) - expect(find('.stage-events')).to have_content(@build.short_sha) - expect(find('.stage-events')).to have_content("##{@build.id}") + expect(find(".stage-events")).to have_content(@build.ref) + expect(find(".stage-events")).to have_content(@build.short_sha) + expect(find(".stage-events")).to have_content("##{@build.id}") end def expect_merge_request_to_be_present - expect(find('.stage-events')).to have_content(mr.title) - expect(find('.stage-events')).to have_content(mr.author.name) - expect(find('.stage-events')).to have_content("!#{mr.iid}") + expect(find(".stage-events")).to have_content(mr.title) + expect(find(".stage-events")).to have_content(mr.author.name) + expect(find(".stage-events")).to have_content("!#{mr.iid}") end def click_stage(stage_name) - find('.stage-nav li', text: stage_name).click + find(".stage-nav li", text: stage_name).click wait_for_requests end end |