diff options
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/merges_permissions_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/features/merges_permissions_spec.rb b/spec/features/merges_permissions_spec.rb new file mode 100644 index 000000000..e8af3b5e8 --- /dev/null +++ b/spec/features/merges_permissions_spec.rb @@ -0,0 +1,31 @@ +describe "Merges", :type => :feature do + login_user + + describe 'permissions' do + before do + allow_any_instance_of(MergePolicy).to receive(:create?).and_return permission + visit path + end + + describe 'on show view' do + let( :path ){ workbench_output_path(referential.workbench) } + let(:button_text) { I18n.t('merges.actions.create') } + + context 'if present → ' do + let( :permission ){ true } + it 'view shows the corresponding buttons' do + expected_new_url = new_workbench_merge_path(referential.workbench) + expect( page ).to have_link(button_text, href: expected_new_url) + end + end + + context 'if absent → ' do + let( :permission ){ false } + it 'view does not show the corresponding buttons' do + expect( page ).not_to have_link(button_text) + end + end + end + + end +end |
