diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-24 10:54:42 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-24 10:54:42 +0300 |
commit | e21ca9f8b140476f93eaa2c2a0d6bf96f28b6995 (patch) | |
tree | ecaa584f33ed4d5231d07d6dddc8675feb8f19ad /features | |
parent | 4a1e98e4b69800c0044110c1aff6cfdf972b57b6 (diff) | |
parent | e1d307bf4b88afa59d851918c29ffbb61b01e8c5 (diff) | |
download | gitlab-ce-e21ca9f8b140476f93eaa2c2a0d6bf96f28b6995.tar.gz |
Merge branch 'star' of https://github.com/cirosantilli/gitlabhq into cirosantilli-star
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Conflicts:
CHANGELOG
Diffstat (limited to 'features')
-rw-r--r-- | features/project/star.feature | 38 | ||||
-rw-r--r-- | features/steps/explore/projects.rb | 24 | ||||
-rw-r--r-- | features/steps/project/star.rb | 29 | ||||
-rw-r--r-- | features/steps/shared/authentication.rb | 4 | ||||
-rw-r--r-- | features/steps/shared/paths.rb | 32 | ||||
-rw-r--r-- | features/steps/shared/project.rb | 8 |
6 files changed, 107 insertions, 28 deletions
diff --git a/features/project/star.feature b/features/project/star.feature new file mode 100644 index 00000000000..d8d898155fe --- /dev/null +++ b/features/project/star.feature @@ -0,0 +1,38 @@ +Feature: Project Star + Scenario: New projects have 0 stars + Given public project "Community" + When I visit project "Community" page + Then The project has 0 stars + + Scenario: Empty projects show star count + Given public empty project "Empty Public Project" + When I visit empty project page + Then The project has 0 stars + + Scenario: Signed off users can't star projects + Given public project "Community" + And I visit project "Community" page + When I click on the star toggle button + Then The project has 0 stars + + @javascript + Scenario: Signed in users can toggle star + Given I sign in as "John Doe" + And public project "Community" + And I visit project "Community" page + When I click on the star toggle button + Then The project has 1 star + When I click on the star toggle button + Then The project has 0 stars + + @javascript + Scenario: Star count sums stars + Given I sign in as "John Doe" + And public project "Community" + And I visit project "Community" page + And I click on the star toggle button + And I logout + And I sign in as "Mary Jane" + And I visit project "Community" page + When I click on the star toggle button + Then The project has 2 stars diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb index 8aa2916014b..dfd51060738 100644 --- a/features/steps/explore/projects.rb +++ b/features/steps/explore/projects.rb @@ -3,10 +3,6 @@ class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps include SharedPaths include SharedProject - step 'public empty project "Empty Public Project"' do - create :empty_project, :public, name: 'Empty Public Project' - end - step 'I should see project "Empty Public Project"' do page.should have_content "Empty Public Project" end @@ -20,16 +16,6 @@ class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps page.should have_content 'README.md' end - step 'I visit empty project page' do - project = Project.find_by(name: 'Empty Public Project') - visit project_path(project) - end - - step 'I visit project "Community" page' do - project = Project.find_by(name: 'Community') - visit project_path(project) - end - step 'I should see empty public project details' do page.should have_content 'Git global setup' end @@ -48,22 +34,12 @@ class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps end end - step 'I visit project "Enterprise" page' do - project = Project.find_by(name: 'Enterprise') - visit project_path(project) - end - step 'I should see project "Community" home page' do within '.project-home-title' do page.should have_content 'Community' end end - step 'I visit project "Internal" page' do - project = Project.find_by(name: 'Internal') - visit project_path(project) - end - step 'I should see project "Internal" home page' do within '.project-home-title' do page.should have_content 'Internal' diff --git a/features/steps/project/star.rb b/features/steps/project/star.rb new file mode 100644 index 00000000000..11102900ed4 --- /dev/null +++ b/features/steps/project/star.rb @@ -0,0 +1,29 @@ +class Spinach::Features::ProjectStar < Spinach::FeatureSteps + include SharedAuthentication + include SharedProject + include SharedPaths + include SharedUser + + step "The project has 0 stars" do + has_n_stars(0) + end + + step "The project has 1 star" do + has_n_stars(1) + end + + step "The project has 2 stars" do + has_n_stars(2) + end + + # Requires @javascript + step "I click on the star toggle button" do + page.find(".star .toggle", visible: true).click + end + + protected + + def has_n_stars(n) + expect(page).to have_css(".star .count", text: /^#{n}$/, visible: true) + end +end diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb index b8c11ce0a23..b48021dc146 100644 --- a/features/steps/shared/authentication.rb +++ b/features/steps/shared/authentication.rb @@ -24,6 +24,10 @@ module SharedAuthentication current_path.should == new_user_session_path end + step "I logout" do + logout + end + def current_user @user || User.first end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index a0b4099ab3e..111d40c0e1b 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -320,6 +320,34 @@ module SharedPaths end # ---------------------------------------- + # Visibility Projects + # ---------------------------------------- + + step 'I visit project "Community" page' do + project = Project.find_by(name: "Community") + visit project_path(project) + end + + step 'I visit project "Internal" page' do + project = Project.find_by(name: "Internal") + visit project_path(project) + end + + step 'I visit project "Enterprise" page' do + project = Project.find_by(name: "Enterprise") + visit project_path(project) + end + + # ---------------------------------------- + # Empty Projects + # ---------------------------------------- + + step "I visit empty project page" do + project = Project.find_by(name: "Empty Public Project") + visit project_path(project) + end + + # ---------------------------------------- # Public Projects # ---------------------------------------- @@ -327,10 +355,6 @@ module SharedPaths visit explore_projects_path end - step 'I visit public page for "Community" project' do - visit public_project_path(Project.find_by(name: "Community")) - end - # ---------------------------------------- # Public Groups # ---------------------------------------- diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index ddb87daeeb7..ba6f090a706 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -122,4 +122,12 @@ module SharedProject project ||= create :empty_project, :public, name: 'Community', namespace: user.namespace project.team << [user, :master] end + + # ---------------------------------------- + # Empty projects + # ---------------------------------------- + + step 'public empty project "Empty Public Project"' do + create :empty_project, :public, name: "Empty Public Project" + end end |