blob: e4cd8294f7af1d318c46a0d6e14d39f662f4cecc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# frozen_string_literal: true
require 'spec_helper'
describe 'Projects > Show > 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
|