diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-08-30 08:54:43 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-08-30 08:54:43 +1100 |
commit | 569c7becf0ef18f56d03d738b8fedadbec869c08 (patch) | |
tree | fd361e47517c7bbab065ed42049e95025617a0d5 /spec/features/projects | |
parent | 2be34630623711fc20ef8c101b5cef688f207cc1 (diff) | |
download | gitlab-ce-569c7becf0ef18f56d03d738b8fedadbec869c08.tar.gz |
Replace 'project/star.feature' spinach test with an rspec analog
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/user_interacts_with_stars_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/features/projects/user_interacts_with_stars_spec.rb b/spec/features/projects/user_interacts_with_stars_spec.rb new file mode 100644 index 00000000000..0ac3f8181fa --- /dev/null +++ b/spec/features/projects/user_interacts_with_stars_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe 'User interacts with project stars' do + let(:project) { create(:project, :public, :repository) } + + context 'when user is signed in', js: true do + let(:user) { create(:user) } + + before do + sign_in(user) + visit(project_path(project)) + end + + it 'toggles the star' do + find('.star-btn').click + + expect(page).to have_css('.star-count', text: 1) + + find('.star-btn').click + + expect(page).to have_css('.star-count', text: 0) + end + end + + context 'when user is not signed in' do + before do + visit(project_path(project)) + end + + it 'does not allow to star a project' do + expect(page).not_to have_content('.toggle-star') + + find('.star-btn').click + + expect(current_path).to eq(new_user_session_path) + end + end +end |