blob: ca7038d519126e685c97e33c5693f25167d57ed7 (
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
|
RSpec.describe 'StopAreaReferentials', type: :feature do
login_user
let(:stop_area_referential) { first_workgroup.stop_area_referential }
describe 'permissions' do
before do
allow_any_instance_of(StopAreaReferentialPolicy).to receive(:synchronize?).and_return permission
visit path
end
context 'on show view' do
let( :path ){ stop_area_referential_path(stop_area_referential.id) }
context 'if present → ' do
let( :permission ){ true }
it 'shows an edit button' do
expect(page).to have_css('a.btn.btn-default', text: I18n.t('actions.sync'))
end
end
context 'if absent → ' do
let( :permission ){ false }
it 'does not show any edit button' do
expect(page).not_to have_css('a.btn.btn-default', text: I18n.t('actions.sync'))
end
end
end
end
end
|