summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSemyon Pupkov <mail@semyonpupkov.com>2017-01-04 13:30:11 +0500
committerSemyon Pupkov <mail@semyonpupkov.com>2017-01-04 13:30:11 +0500
commite393151d76c5847de46e8d956e6c5947e321e156 (patch)
tree7caeb9fba4538fad20c10baa55cbf493a025eae5
parent115aac77f614a9130aa9bc6ff48aed47339aebfc (diff)
downloadgitlab-ce-e393151d76c5847de46e8d956e6c5947e321e156.tar.gz
Move dashboard archived projects spinach tests to rspec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
-rw-r--r--features/dashboard/archived_projects.feature17
-rw-r--r--features/steps/dashboard/archived_projects.rb26
-rw-r--r--spec/factories/projects.rb4
-rw-r--r--spec/features/dashboard/archived_projects_spec.rb28
4 files changed, 32 insertions, 43 deletions
diff --git a/features/dashboard/archived_projects.feature b/features/dashboard/archived_projects.feature
deleted file mode 100644
index bed9282f1c6..00000000000
--- a/features/dashboard/archived_projects.feature
+++ /dev/null
@@ -1,17 +0,0 @@
-@dashboard
-Feature: Dashboard Archived Projects
- Background:
- Given I sign in as a user
- And I own project "Shop"
- And I own project "Forum"
- And project "Forum" is archived
- And I visit dashboard page
-
- Scenario: I should see non-archived projects on dashboard
- Then I should see "Shop" project link
- And I should not see "Forum" project link
-
- Scenario: I toggle show of archived projects on dashboard
- When I click "Show archived projects" link
- Then I should see "Shop" project link
- And I should see "Forum" project link
diff --git a/features/steps/dashboard/archived_projects.rb b/features/steps/dashboard/archived_projects.rb
deleted file mode 100644
index 6510f8d9b32..00000000000
--- a/features/steps/dashboard/archived_projects.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-class Spinach::Features::DashboardArchivedProjects < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedPaths
- include SharedProject
-
- When 'project "Forum" is archived' do
- project = Project.find_by(name: "Forum")
- project.update_attribute(:archived, true)
- end
-
- step 'I should see "Shop" project link' do
- expect(page).to have_link "Shop"
- end
-
- step 'I should not see "Forum" project link' do
- expect(page).not_to have_link "Forum"
- end
-
- step 'I should see "Forum" project link' do
- expect(page).to have_link "Forum"
- end
-
- step 'I click "Show archived projects" link' do
- click_link "Show archived projects"
- end
-end
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index f7fa834d7a2..1cdbe4fc9a5 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -24,6 +24,10 @@ FactoryGirl.define do
visibility_level Gitlab::VisibilityLevel::PRIVATE
end
+ trait :archived do
+ archived true
+ end
+
trait :access_requestable do
request_access_enabled true
end
diff --git a/spec/features/dashboard/archived_projects_spec.rb b/spec/features/dashboard/archived_projects_spec.rb
new file mode 100644
index 00000000000..038c1641be9
--- /dev/null
+++ b/spec/features/dashboard/archived_projects_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+RSpec.describe 'Dashboard Archived Project', feature: true do
+ let(:user) { create :user }
+ let(:project) { create :project}
+ let(:archived_project) { create(:project, :archived) }
+
+ before do
+ project.team << [user, :master]
+ archived_project.team << [user, :master]
+
+ login_as(user)
+
+ visit dashboard_projects_path
+ end
+
+ it 'renders non archived projects' do
+ expect(page).to have_link(project.name)
+ expect(page).not_to have_link(archived_project.name)
+ end
+
+ it 'renders all projects' do
+ click_link 'Show archived projects'
+
+ expect(page).to have_link(project.name)
+ expect(page).to have_link(archived_project.name)
+ end
+end