diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-04 14:55:23 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-12-11 20:02:09 +0300 |
commit | e80e3f5372d6bcad1fbe04a85b3086bb66794828 (patch) | |
tree | 16b1539cfd158ecac7fe05d595cbba30b8bc1a04 /spec/features | |
parent | 8b4cdc50fca816b4f56f8579e17c4dba836ec797 (diff) |
Migrate CI::Project to Project
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/atom/builds_spec.rb (renamed from spec/features/ci/admin/builds_spec.rb) | 35 | ||||
-rw-r--r-- | spec/features/atom/runners_spec.rb (renamed from spec/features/ci/admin/runners_spec.rb) | 10 | ||||
-rw-r--r-- | spec/features/builds_spec.rb | 24 | ||||
-rw-r--r-- | spec/features/ci/admin/events_spec.rb | 20 | ||||
-rw-r--r-- | spec/features/ci/admin/projects_spec.rb | 19 | ||||
-rw-r--r-- | spec/features/ci_settings_spec.rb | 22 | ||||
-rw-r--r-- | spec/features/commits_spec.rb | 3 | ||||
-rw-r--r-- | spec/features/lint_spec.rb (renamed from spec/features/ci/lint_spec.rb) | 0 | ||||
-rw-r--r-- | spec/features/runners_spec.rb | 38 | ||||
-rw-r--r-- | spec/features/triggers_spec.rb | 13 | ||||
-rw-r--r-- | spec/features/variables_spec.rb | 9 |
11 files changed, 64 insertions, 129 deletions
diff --git a/spec/features/ci/admin/builds_spec.rb b/spec/features/atom/builds_spec.rb index 623d466c67b..72764b1629d 100644 --- a/spec/features/ci/admin/builds_spec.rb +++ b/spec/features/atom/builds_spec.rb @@ -5,17 +5,16 @@ describe "Admin Builds" do let(:build) { FactoryGirl.create :ci_build, commit: commit } before do - skip_ci_admin_auth - login_as :user + login_as :admin end describe "GET /admin/builds" do before do build - visit ci_admin_builds_path + visit admin_builds_path end - it { expect(page).to have_content "All builds" } + it { expect(page).to have_content "Running" } it { expect(page).to have_content build.short_sha } end @@ -26,43 +25,43 @@ describe "Admin Builds" do FactoryGirl.create :ci_build, commit: commit, status: "success" FactoryGirl.create :ci_build, commit: commit, status: "failed" - visit ci_admin_builds_path + visit admin_builds_path + + within ".center-top-menu" do + click_on "All" + end expect(page.all(".build-link").size).to eq(4) end - it "shows pending builds" do + it "shows finished builds" do build = FactoryGirl.create :ci_build, commit: commit, status: "pending" build1 = FactoryGirl.create :ci_build, commit: commit, status: "running" build2 = FactoryGirl.create :ci_build, commit: commit, status: "success" - build3 = FactoryGirl.create :ci_build, commit: commit, status: "failed" - visit ci_admin_builds_path + visit admin_builds_path - within ".nav.nav-tabs" do - click_on "Pending" + within ".center-top-menu" do + click_on "Finished" end - expect(page.find(".build-link")).to have_content(build.id) + expect(page.find(".build-link")).not_to have_content(build.id) expect(page.find(".build-link")).not_to have_content(build1.id) - expect(page.find(".build-link")).not_to have_content(build2.id) - expect(page.find(".build-link")).not_to have_content(build3.id) + expect(page.find(".build-link")).to have_content(build2.id) end it "shows running builds" do build = FactoryGirl.create :ci_build, commit: commit, status: "pending" - build1 = FactoryGirl.create :ci_build, commit: commit, status: "running" build2 = FactoryGirl.create :ci_build, commit: commit, status: "success" build3 = FactoryGirl.create :ci_build, commit: commit, status: "failed" - visit ci_admin_builds_path + visit admin_builds_path - within ".nav.nav-tabs" do + within ".center-top-menu" do click_on "Running" end - expect(page.find(".build-link")).to have_content(build1.id) - expect(page.find(".build-link")).not_to have_content(build.id) + expect(page.find(".build-link")).to have_content(build.id) expect(page.find(".build-link")).not_to have_content(build2.id) expect(page.find(".build-link")).not_to have_content(build3.id) end diff --git a/spec/features/ci/admin/runners_spec.rb b/spec/features/atom/runners_spec.rb index b83744f53a8..b1f2d401042 100644 --- a/spec/features/ci/admin/runners_spec.rb +++ b/spec/features/atom/runners_spec.rb @@ -10,7 +10,7 @@ describe "Admin Runners" do runner = FactoryGirl.create(:ci_runner) commit = FactoryGirl.create(:ci_commit) FactoryGirl.create(:ci_build, commit: commit, runner_id: runner.id) - visit ci_admin_runners_path + visit admin_runners_path end it { page.has_text? "Manage Runners" } @@ -36,9 +36,9 @@ describe "Admin Runners" do let(:runner) { FactoryGirl.create :ci_runner } before do - @project1 = FactoryGirl.create(:ci_project) - @project2 = FactoryGirl.create(:ci_project) - visit ci_admin_runner_path(runner) + @project1 = FactoryGirl.create(:empty_project) + @project2 = FactoryGirl.create(:empty_project) + visit admin_runner_path(runner) end describe 'runner info' do @@ -53,7 +53,7 @@ describe "Admin Runners" do describe 'search' do before do search_form = find('#runner-projects-search') - search_form.fill_in 'search', with: @project1.gl_project.name + search_form.fill_in 'search', with: @project1.name search_form.click_button 'Search' end diff --git a/spec/features/builds_spec.rb b/spec/features/builds_spec.rb index 1f99a808f87..61d81cb0c8e 100644 --- a/spec/features/builds_spec.rb +++ b/spec/features/builds_spec.rb @@ -7,15 +7,15 @@ describe "Builds" do login_as(:user) @commit = FactoryGirl.create :ci_commit @build = FactoryGirl.create :ci_build, commit: @commit - @gl_project = @commit.project.gl_project - @gl_project.team << [@user, :master] + @project = @commit.project + @project.team << [@user, :master] end describe "GET /:project/builds" do context "Running scope" do before do @build.run! - visit namespace_project_builds_path(@gl_project.namespace, @gl_project) + visit namespace_project_builds_path(@project.namespace, @project) end it { expect(page).to have_content 'Running' } @@ -28,7 +28,7 @@ describe "Builds" do context "Finished scope" do before do @build.run! - visit namespace_project_builds_path(@gl_project.namespace, @gl_project, scope: :finished) + visit namespace_project_builds_path(@project.namespace, @project, scope: :finished) end it { expect(page).to have_content 'No builds to show' } @@ -37,8 +37,8 @@ describe "Builds" do context "All builds" do before do - @gl_project.ci_builds.running_or_pending.each(&:success) - visit namespace_project_builds_path(@gl_project.namespace, @gl_project, scope: :all) + @project.ci_builds.running_or_pending.each(&:success) + visit namespace_project_builds_path(@project.namespace, @project, scope: :all) end it { expect(page).to have_content 'All' } @@ -52,7 +52,7 @@ describe "Builds" do describe "POST /:project/builds/:id/cancel_all" do before do @build.run! - visit namespace_project_builds_path(@gl_project.namespace, @gl_project) + visit namespace_project_builds_path(@project.namespace, @project) click_link "Cancel running" end @@ -62,7 +62,7 @@ describe "Builds" do describe "GET /:project/builds/:id" do before do - visit namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + visit namespace_project_build_path(@project.namespace, @project, @build) end it { expect(page).to have_content @commit.sha[0..7] } @@ -72,7 +72,7 @@ describe "Builds" do context "Download artifacts" do before do @build.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + visit namespace_project_build_path(@project.namespace, @project, @build) end it { expect(page).to have_content 'Download artifacts' } @@ -82,7 +82,7 @@ describe "Builds" do describe "POST /:project/builds/:id/cancel" do before do @build.run! - visit namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + visit namespace_project_build_path(@project.namespace, @project, @build) click_link "Cancel" end @@ -93,7 +93,7 @@ describe "Builds" do describe "POST /:project/builds/:id/retry" do before do @build.run! - visit namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + visit namespace_project_build_path(@project.namespace, @project, @build) click_link "Cancel" click_link 'Retry' end @@ -105,7 +105,7 @@ describe "Builds" do describe "GET /:project/builds/:id/download" do before do @build.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_build_path(@gl_project.namespace, @gl_project, @build) + visit namespace_project_build_path(@project.namespace, @project, @build) click_link 'Download artifacts' end diff --git a/spec/features/ci/admin/events_spec.rb b/spec/features/ci/admin/events_spec.rb deleted file mode 100644 index a7e75cc4f6b..00000000000 --- a/spec/features/ci/admin/events_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'spec_helper' - -describe "Admin Events" do - let(:event) { FactoryGirl.create :ci_admin_event } - - before do - skip_ci_admin_auth - login_as :user - end - - describe "GET /admin/events" do - before do - event - visit ci_admin_events_path - end - - it { expect(page).to have_content "Events" } - it { expect(page).to have_content event.description } - end -end diff --git a/spec/features/ci/admin/projects_spec.rb b/spec/features/ci/admin/projects_spec.rb deleted file mode 100644 index b88f55a6807..00000000000 --- a/spec/features/ci/admin/projects_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe "Admin Projects" do - let(:project) { FactoryGirl.create :ci_project } - - before do - skip_ci_admin_auth - login_as :user - end - - describe "GET /admin/projects" do - before do - project - visit ci_admin_projects_path - end - - it { expect(page).to have_content "Projects" } - end -end diff --git a/spec/features/ci_settings_spec.rb b/spec/features/ci_settings_spec.rb deleted file mode 100644 index 7e25e883018..00000000000 --- a/spec/features/ci_settings_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'spec_helper' - -describe "CI settings" do - let(:user) { create(:user) } - before { login_as(user) } - - before do - @project = FactoryGirl.create :ci_project - @gl_project = @project.gl_project - @gl_project.team << [user, :master] - visit edit_namespace_project_ci_settings_path(@gl_project.namespace, @gl_project) - end - - it { expect(page).to have_content 'Build Schedule' } - - it "updates configuration" do - fill_in 'Timeout', with: '70' - click_button 'Save changes' - expect(page).to have_content 'was successfully updated' - expect(find_field('Timeout').value).to eq '70' - end -end diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index 90739cd6a28..cc0d4c150fe 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -9,8 +9,7 @@ describe "Commits" do before do login_as :user project.team << [@user, :master] - @ci_project = project.ensure_gitlab_ci_project - @commit = FactoryGirl.create :ci_commit, gl_project: project, sha: project.commit.sha + @commit = FactoryGirl.create :ci_commit, project: project, sha: project.commit.sha @build = FactoryGirl.create :ci_build, commit: @commit @generic_status = FactoryGirl.create :generic_commit_status, commit: @commit end diff --git a/spec/features/ci/lint_spec.rb b/spec/features/lint_spec.rb index 5d8f56e2cfb..5d8f56e2cfb 100644 --- a/spec/features/ci/lint_spec.rb +++ b/spec/features/lint_spec.rb diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb index b0259026630..a4562f2fae8 100644 --- a/spec/features/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -8,24 +8,24 @@ describe "Runners" do describe "specific runners" do before do - @project = FactoryGirl.create :ci_project - @project.gl_project.team << [user, :master] + @project = FactoryGirl.create :empty_project, shared_runners_enabled: false + @project.team << [user, :master] - @project2 = FactoryGirl.create :ci_project - @project2.gl_project.team << [user, :master] + @project2 = FactoryGirl.create :empty_project + @project2.team << [user, :master] - @project3 = FactoryGirl.create :ci_project - @project3.gl_project.team << [user, :developer] + @project3 = FactoryGirl.create :empty_project + @project3.team << [user, :developer] @shared_runner = FactoryGirl.create :ci_shared_runner @specific_runner = FactoryGirl.create :ci_specific_runner @specific_runner2 = FactoryGirl.create :ci_specific_runner @specific_runner3 = FactoryGirl.create :ci_specific_runner - @project.runners << @specific_runner - @project2.runners << @specific_runner2 - @project3.runners << @specific_runner3 + @project.ci_runners << @specific_runner + @project2.ci_runners << @specific_runner2 + @project3.ci_runners << @specific_runner3 - visit runners_path(@project.gl_project) + visit runners_path(@project) end before do @@ -48,8 +48,8 @@ describe "Runners" do end it "disables specific runner for project" do - @project2.runners << @specific_runner - visit runners_path(@project.gl_project) + @project2.ci_runners << @specific_runner + visit runners_path(@project) within ".activated-specific-runners" do click_on "Disable for this project" @@ -69,9 +69,9 @@ describe "Runners" do describe "shared runners" do before do - @project = FactoryGirl.create :ci_project - @project.gl_project.team << [user, :master] - visit runners_path(@project.gl_project) + @project = FactoryGirl.create :empty_project, shared_runners_enabled: false + @project.team << [user, :master] + visit runners_path(@project) end it "enables shared runners" do @@ -82,14 +82,14 @@ describe "Runners" do describe "show page" do before do - @project = FactoryGirl.create :ci_project - @project.gl_project.team << [user, :master] + @project = FactoryGirl.create :empty_project + @project.team << [user, :master] @specific_runner = FactoryGirl.create :ci_specific_runner - @project.runners << @specific_runner + @project.ci_runners << @specific_runner end it "shows runner information" do - visit runners_path(@project.gl_project) + visit runners_path(@project) click_on @specific_runner.short_sha expect(page).to have_content(@specific_runner.platform) end diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 69492d58878..b0705a45aee 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -5,25 +5,24 @@ describe 'Triggers' do before { login_as(user) } before do - @project = FactoryGirl.create :ci_project - @gl_project = @project.gl_project - @gl_project.team << [user, :master] - visit namespace_project_triggers_path(@gl_project.namespace, @gl_project) + @project = FactoryGirl.create :empty_project + @project.team << [user, :master] + visit namespace_project_triggers_path(@project.namespace, @project) end context 'create a trigger' do before do click_on 'Add Trigger' - expect(@project.triggers.count).to eq(1) + expect(@project.ci_triggers.count).to eq(1) end it 'contains trigger token' do - expect(page).to have_content(@project.triggers.first.token) + expect(page).to have_content(@project.ci_triggers.first.token) end it 'revokes the trigger' do click_on 'Revoke' - expect(@project.triggers.count).to eq(0) + expect(@project.ci_triggers.count).to eq(0) end end end diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index adb602f3edd..a6e68eeefbc 100644 --- a/spec/features/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -6,20 +6,19 @@ describe "Variables" do describe "specific runners" do before do - @project = FactoryGirl.create :ci_project - @gl_project = @project.gl_project - @gl_project.team << [user, :master] + @project = FactoryGirl.create :empty_project + @project.team << [user, :master] end it "creates variable", js: true do - visit namespace_project_variables_path(@gl_project.namespace, @gl_project) + visit namespace_project_variables_path(@project.namespace, @project) click_on "Add a variable" fill_in "Key", with: "SECRET_KEY" fill_in "Value", with: "SECRET_VALUE" click_on "Save changes" expect(page).to have_content("Variables were successfully updated.") - expect(@project.variables.count).to eq(1) + expect(@project.ci_variables.count).to eq(1) end end end |