gitlab-org--gitlab-foss/spec/features/projects/user_interacts_with_stars_spec.rb
Jacopo 0ce6785851 Replaces tag: true into :tag in the specs
Replaces all the explicit include metadata syntax in the specs (tag:
true) into the implicit one (:tag).
Added a cop to prevent future errors and handle autocorrection.
2017-10-07 13:57:54 +02:00

38 lines
809 B
Ruby

require 'spec_helper'
describe 'User interacts with project stars' do
let(:project) { create(:project, :public, :repository) }
context 'when user is signed in', :js 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