diff options
author | Rémy Coutable <remy@rymai.me> | 2017-09-18 08:39:32 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-18 08:39:32 +0000 |
commit | d73eb894ca5ab0978cdd2bd942f734af8461767e (patch) | |
tree | 5d2e3f99fd30929cad138b709b003049c3d2abe9 | |
parent | d00f7ba28c90bd8d44ba2521d97b97f5d9d1d32c (diff) | |
parent | e6d5a6a370940d16891bb7e84e7b19bfab164c50 (diff) | |
download | gitlab-ce-d73eb894ca5ab0978cdd2bd942f734af8461767e.tar.gz |
Merge branch 'replace_project_archived.feature' into 'master'
Replace the 'project/archived.feature' spinach test with an rspec analog
See merge request gitlab-org/gitlab-ce!14322
-rw-r--r-- | changelogs/unreleased/replace_project_archived-feature.yml | 5 | ||||
-rw-r--r-- | features/project/archived.feature | 30 | ||||
-rw-r--r-- | features/steps/project/archived.rb | 36 | ||||
-rw-r--r-- | spec/features/projects/user_archives_project_spec.rb | 43 |
4 files changed, 48 insertions, 66 deletions
diff --git a/changelogs/unreleased/replace_project_archived-feature.yml b/changelogs/unreleased/replace_project_archived-feature.yml new file mode 100644 index 00000000000..d0697347aa0 --- /dev/null +++ b/changelogs/unreleased/replace_project_archived-feature.yml @@ -0,0 +1,5 @@ +--- +title: Replace the 'project/archived.feature' spinach test with an rspec analog +merge_request: 14322 +author: Vitaliy @blackst0ne Klachkov +type: other diff --git a/features/project/archived.feature b/features/project/archived.feature deleted file mode 100644 index ad466f4f307..00000000000 --- a/features/project/archived.feature +++ /dev/null @@ -1,30 +0,0 @@ -Feature: Project Archived - Background: - Given I sign in as a user - And I own project "Shop" - And I own project "Forum" - - Scenario: I should not see archived on project page of not-archive project - And project "Forum" is archived - And I visit project "Shop" page - Then I should not see "Archived" - - Scenario: I should see archived on project page of archive project - And project "Forum" is archived - And I visit project "Forum" page - Then I should see "Archived" - - Scenario: I archive project - When project "Shop" has push event - And I visit project "Shop" page - And I visit edit project "Shop" page - And I set project archived - Then I should see "Archived" - - Scenario: I unarchive project - When project "Shop" has push event - And project "Shop" is archived - And I visit project "Shop" page - And I visit edit project "Shop" page - And I set project unarchived - Then I should not see "Archived" diff --git a/features/steps/project/archived.rb b/features/steps/project/archived.rb deleted file mode 100644 index e4847180be9..00000000000 --- a/features/steps/project/archived.rb +++ /dev/null @@ -1,36 +0,0 @@ -class Spinach::Features::ProjectArchived < Spinach::FeatureSteps - include SharedAuthentication - include SharedProject - include SharedPaths - - When 'project "Forum" is archived' do - project = Project.find_by(name: "Forum") - project.update_attribute(:archived, true) - end - - When 'project "Shop" is archived' do - project = Project.find_by(name: "Shop") - project.update_attribute(:archived, true) - end - - When 'I visit project "Forum" page' do - project = Project.find_by(name: "Forum") - visit project_path(project) - end - - step 'I should not see "Archived"' do - expect(page).not_to have_content "Archived" - end - - step 'I should see "Archived"' do - expect(page).to have_content "Archived" - end - - When 'I set project archived' do - click_link "Archive" - end - - When 'I set project unarchived' do - click_link "Unarchive" - end -end diff --git a/spec/features/projects/user_archives_project_spec.rb b/spec/features/projects/user_archives_project_spec.rb new file mode 100644 index 00000000000..72063d13c2a --- /dev/null +++ b/spec/features/projects/user_archives_project_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +describe 'User archives a project' do + let(:user) { create(:user) } + + before do + project.add_master(user) + + sign_in(user) + end + + context 'when a project is archived' do + let(:project) { create(:project, :archived, namespace: user.namespace) } + + before do + visit(edit_project_path(project)) + end + + it 'unarchives a project' do + expect(page).to have_content('Unarchive project') + + click_link('Unarchive') + + expect(page).not_to have_content('Archived project') + end + end + + context 'when a project is unarchived' do + let(:project) { create(:project, :repository, namespace: user.namespace) } + + before do + visit(edit_project_path(project)) + end + + it 'archives a project' do + expect(page).to have_content('Archive project') + + click_link('Archive') + + expect(page).to have_content('Archived') + end + end +end |