diff options
| author | Robert | 2017-07-10 22:19:01 +0200 |
|---|---|---|
| committer | Robert | 2017-07-10 22:32:00 +0200 |
| commit | 25d99e6fc46db9a37fcbcae83b008ff96bc00520 (patch) | |
| tree | ae30ed535a2eda288fca628ec4b5c83470bc14a3 /spec/features | |
| parent | 1ab9c3364ffcd777dae39bd9154dca031cc00db0 (diff) | |
| download | chouette-core-25d99e6fc46db9a37fcbcae83b008ff96bc00520.tar.bz2 | |
Refs: #4021@1.5h; Added spec for incorrectly shown `Créer` button on calenders#index view and made them pass
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/calendars_permissions_spec.rb | 26 | ||||
| -rw-r--r-- | spec/features/connection_links_spec.rb | 5 |
2 files changed, 22 insertions, 9 deletions
diff --git a/spec/features/calendars_permissions_spec.rb b/spec/features/calendars_permissions_spec.rb index 6eb0ea08e..9b47ab2bb 100644 --- a/spec/features/calendars_permissions_spec.rb +++ b/spec/features/calendars_permissions_spec.rb @@ -1,15 +1,13 @@ -# -*- coding: utf-8 -*- -require 'spec_helper' - -describe 'Calendars', type: :feature do +RSpec.describe 'Calendars', type: :feature do login_user let(:calendar) { create :calendar, organisation_id: 1 } describe 'permissions' do before do - allow_any_instance_of(CalendarPolicy).to receive(:edit?).and_return permission + allow_any_instance_of(CalendarPolicy).to receive(:create?).and_return permission allow_any_instance_of(CalendarPolicy).to receive(:destroy?).and_return permission + allow_any_instance_of(CalendarPolicy).to receive(:edit?).and_return permission allow_any_instance_of(CalendarPolicy).to receive(:share?).and_return permission visit path end @@ -51,5 +49,23 @@ describe 'Calendars', type: :feature do end end end + + context 'on index view' do + let( :path ){ calendars_path } + + context 'if present → ' do + let( :permission ){ true } + it 'index shows an edit button' do + expect(page).to have_css('a.btn.btn-default', text: 'Créer') + end + end + + context 'if absent → ' do + let( :permission ){ false } + it 'index does not show any edit button' do + expect(page).not_to have_css('a.btn.btn-default', text: 'Créer') + end + end + end end end diff --git a/spec/features/connection_links_spec.rb b/spec/features/connection_links_spec.rb index 524fbb89a..0325e6e1c 100644 --- a/spec/features/connection_links_spec.rb +++ b/spec/features/connection_links_spec.rb @@ -1,7 +1,4 @@ -# -*- coding: utf-8 -*- -require 'spec_helper' - -describe "ConnectionLinks", :type => :feature do +RSpec.describe "ConnectionLinks", :type => :feature do login_user let!(:connection_links) { Array.new(2) { create(:connection_link) } } |
