Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/show/user_interacts_with_stars_spec.rb')
-rw-r--r--spec/features/projects/show/user_interacts_with_stars_spec.rb38
1 files changed, 36 insertions, 2 deletions
diff --git a/spec/features/projects/show/user_interacts_with_stars_spec.rb b/spec/features/projects/show/user_interacts_with_stars_spec.rb
index aa61b629d92..e0dd4f65010 100644
--- a/spec/features/projects/show/user_interacts_with_stars_spec.rb
+++ b/spec/features/projects/show/user_interacts_with_stars_spec.rb
@@ -14,14 +14,36 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do
end
it 'toggles the star' do
- find('.star-btn').click
+ star_project
expect(page).to have_css('.star-count', text: 1)
- find('.star-btn').click
+ unstar_project
expect(page).to have_css('.star-count', text: 0)
end
+
+ it 'validates starring a project' do
+ project.add_owner(user)
+
+ star_project
+
+ visit(dashboard_projects_path)
+
+ expect(page).to have_css('.stars', text: 1)
+ end
+
+ it 'validates un-starring a project' do
+ project.add_owner(user)
+
+ star_project
+
+ unstar_project
+
+ visit(dashboard_projects_path)
+
+ expect(page).to have_css('.stars', text: 0)
+ end
end
context 'when user is not signed in' do
@@ -38,3 +60,15 @@ RSpec.describe 'Projects > Show > User interacts with project stars' do
end
end
end
+
+private
+
+def star_project
+ click_button(_('Star'))
+ wait_for_requests
+end
+
+def unstar_project
+ click_button(_('Unstar'))
+ wait_for_requests
+end