aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuc Donnet2017-07-25 22:15:35 +0200
committerLuc Donnet2017-07-25 22:15:35 +0200
commitcbfe9501f2d2cfc38cbe6ac12180e372dd78eca7 (patch)
treedbe70647c87af0d779dbba06e20d0f0c2b4a294a /spec
parentea3ad8d1f9db76e3d2dfc5f96c930af8db074690 (diff)
parentcada0f02d732dce25492d7f7eb6d6232d56188dd (diff)
downloadchouette-core-cbfe9501f2d2cfc38cbe6ac12180e372dd78eca7.tar.bz2
Merge branch 'master' into staging
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/devise/cas_sessions_controller_spec.rb26
-rw-r--r--spec/decorators/referential_decorator_spec.rb5
-rw-r--r--spec/lib/stif/permission_translator_spec.rb39
-rw-r--r--spec/models/calendar_observer_spec.rb8
-rw-r--r--spec/models/chouette/line_spec.rb11
-rw-r--r--spec/models/chouette/stop_area_spec.rb19
-rw-r--r--spec/models/chouette/time_table_spec.rb39
-rw-r--r--spec/models/chouette/vehicle_journey_at_stop_spec.rb49
-rw-r--r--spec/models/chouette/vehicle_journey_spec.rb23
-rw-r--r--spec/models/referential_spec.rb3
-rw-r--r--spec/models/time_table_combination_spec.rb76
-rw-r--r--spec/models/user_spec.rb8
-rw-r--r--spec/policies/referential_policy_spec.rb2
-rw-r--r--spec/support/permissions.rb1
14 files changed, 252 insertions, 57 deletions
diff --git a/spec/controllers/devise/cas_sessions_controller_spec.rb b/spec/controllers/devise/cas_sessions_controller_spec.rb
index 950d141fd..c82fd2cdb 100644
--- a/spec/controllers/devise/cas_sessions_controller_spec.rb
+++ b/spec/controllers/devise/cas_sessions_controller_spec.rb
@@ -1,25 +1,37 @@
RSpec.describe Devise::CasSessionsController, type: :controller do
- login_user
+ before do
+ @user = signed_in_user
+ allow_any_instance_of(Warden::Proxy).to receive(:authenticate).and_return @user
+ allow_any_instance_of(Warden::Proxy).to receive(:authenticate!).and_return @user
+ @request.env["devise.mapping"] = Devise.mappings[:user]
+ end
+
context 'login is correctly redirected' do
+ let( :signed_in_user ){ build_stubbed :user }
it 'to #service' do
get :new
- expect(response).to redirect_to(unauthenticated_root_path)
+ expect( response ).to be_redirect
+ expect( response.redirect_url ).to eq("http://stif-portail-dev.af83.priv/sessions/login?service=http%3A%2F%2Ftest.host%2Fusers%2Fservice")
end
end
- context 'user does not have any boiv:.+ permission' do
- xit 'cannot login and will be redirected to the login page, with a corresponding message' do
+ context 'user does not have permission sessions:create' do
+ let( :signed_in_user ){ build_stubbed :user }
+
+ it 'cannot login and will be redirected to the login page, with a corresponding message' do
get :service
expect(controller).to set_flash[:alert].to(%r{IBOO})
- expect(response).to redirect_to("http://stif-portail-dev.af83.priv/sessions/login?service=http%3A%2F%2Ftest.host%2Fusers%2Fservice")
+ expect(response).to redirect_to "http://stif-portail-dev.af83.priv/sessions/logout?service=http%3A%2F%2Ftest.host%2Fusers%2Fservice"
end
end
- context 'user does have a boiv:.+ permission' do
+ context 'user does have permission sessions:create' do
+ let( :signed_in_user ){ build_stubbed :allmighty_user }
+
it 'can login and will be redirected to the referentials page' do
- @user.update_attribute :permissions, (@user.permissions << 'boiv:UnameIt')
+ @user.permissions << 'sessions:create'
get :service
expect(response).to redirect_to(authenticated_root_path)
end
diff --git a/spec/decorators/referential_decorator_spec.rb b/spec/decorators/referential_decorator_spec.rb
index 5de6b7e95..16da8d30b 100644
--- a/spec/decorators/referential_decorator_spec.rb
+++ b/spec/decorators/referential_decorator_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do
end
end
- context 'all rights and different organisation' do
+ context 'all rights and different organisation' do
let( :user ){ build_stubbed :allmighty_user }
@@ -33,10 +33,11 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do
expect_action_link_elements.to be_empty
expect_action_link_hrefs.to eq([
referential_time_tables_path(object),
+ new_referential_path(from: object),
])
end
end
- context 'all rights and same organisation' do
+ context 'all rights and same organisation' do
let( :user ){ build_stubbed :allmighty_user, organisation: referential.organisation }
diff --git a/spec/lib/stif/permission_translator_spec.rb b/spec/lib/stif/permission_translator_spec.rb
index 3672c7937..1af21364c 100644
--- a/spec/lib/stif/permission_translator_spec.rb
+++ b/spec/lib/stif/permission_translator_spec.rb
@@ -1,10 +1,45 @@
RSpec.describe Stif::PermissionTranslator do
- context "SSO Permission boiv:read:offer →" do
+ context "No SSO Permissions" do
+ it { expect(described_class.translate([])).to be_empty }
+ end
+
+ context "SSO Permission boiv:read-offer →" do
it "sessions:create only" do
- expect( described_class.translate(%w{boiv:read:offer}) ).to eq(%w{sessions:create})
+ expect( described_class.translate(%w{boiv:read-offer}) ).to eq(%w{sessions:create})
+ end
+
+ end
+
+ context "SSO Permission boiv:edit-offer →" do
+
+ it "all permissions" do
+ expect( described_class.translate(%w{boiv:edit-offer}) ).to eq(Support::Permissions.all_permissions)
+ end
+
+ it "all permissions, no doubletons" do
+ expect( described_class.translate(%w{boiv:edit-offer boiv:read-offer}) ).to eq(Support::Permissions.all_permissions)
end
+ it "all permissions, input order agnostic" do
+ expect( described_class.translate(%w{boiv:read-offer boiv:edit-offer}) ).to eq(Support::Permissions.all_permissions)
+ end
+ end
+
+ context "SSO Permission ignores garbage (no injection) →" do
+ it "remains empty" do
+ expect( described_class.translate(%w{referentials.create}) ).to be_empty
+ end
+
+ it "remains at boiv:read-offer level" do
+ expect( described_class.translate(%w{referentials.create boiv:read-offer calendars.delete}) ).to eq(%w{sessions:create})
+ end
+
+ it "does not add garbage or doubletons for boiv:edit-offer level" do
+ expect(
+ described_class.translate(%w{xxx boiv:read-offer lines.delete boiv:edit-offer footnotes.update})
+ ).to eq(Support::Permissions.all_permissions)
+ end
end
end
diff --git a/spec/models/calendar_observer_spec.rb b/spec/models/calendar_observer_spec.rb
index abb462d25..4fba02bef 100644
--- a/spec/models/calendar_observer_spec.rb
+++ b/spec/models/calendar_observer_spec.rb
@@ -12,14 +12,14 @@ RSpec.describe CalendarObserver, type: :observer do
it 'should schedule mailer on calendar update' do
calendar.name = 'edited_name'
- expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'updated', [calendar, user]
+ expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user.id]
calendar.save
end
it 'should not schedule mailer for none shared calendar on update' do
calendar = create(:calendar, shared: false)
calendar.name = 'edited_name'
- expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'updated', [calendar, user]
+ expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'updated', [calendar.id, user.id]
calendar.save
end
end
@@ -31,12 +31,12 @@ RSpec.describe CalendarObserver, type: :observer do
end
it 'should schedule mailer on calendar create' do
- expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'created', [anything, user]
+ expect(MailerJob).to receive(:perform_later).with 'CalendarMailer', 'created', [anything, user.id]
build(:calendar, shared: true).save
end
it 'should not schedule mailer for none shared calendar on create' do
- expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'created', [anything, user]
+ expect(MailerJob).to_not receive(:perform_later).with 'CalendarMailer', 'created', [anything, user.id]
build(:calendar, shared: false).save
end
end
diff --git a/spec/models/chouette/line_spec.rb b/spec/models/chouette/line_spec.rb
index 5a339e7ed..2e5882012 100644
--- a/spec/models/chouette/line_spec.rb
+++ b/spec/models/chouette/line_spec.rb
@@ -1,17 +1,12 @@
require 'spec_helper'
describe Chouette::Line, :type => :model do
-
subject { create(:line) }
- it { is_expected.to belong_to(:line_referential) }
+ it { should belong_to(:line_referential) }
# it { is_expected.to validate_presence_of :network }
# it { is_expected.to validate_presence_of :company }
-
- it { is_expected.to validate_presence_of :name }
-
- # it { should validate_presence_of :objectid }
- it { is_expected.to validate_uniqueness_of :objectid }
+ it { should validate_presence_of :name }
describe '#display_name' do
it 'should display local_id, number, name and company name' do
@@ -22,7 +17,7 @@ describe Chouette::Line, :type => :model do
describe '#objectid' do
subject { super().objectid }
- it { is_expected.to be_kind_of(Chouette::NetexObjectId) }
+ it { is_expected.to be_kind_of(Chouette::StifCodifligneObjectid) }
end
# it { should validate_numericality_of :objectversion }
diff --git a/spec/models/chouette/stop_area_spec.rb b/spec/models/chouette/stop_area_spec.rb
index 1a2ff8ede..293ae5202 100644
--- a/spec/models/chouette/stop_area_spec.rb
+++ b/spec/models/chouette/stop_area_spec.rb
@@ -7,16 +7,15 @@ describe Chouette::StopArea, :type => :model do
let!(:commercial_stop_point) { create :stop_area, :area_type => "lda" }
let!(:stop_place) { create :stop_area, :area_type => "zdlp" }
- # Refs #1627
- # describe '#objectid' do
- # subject { super().objectid }
- # it { is_expected.to be_kind_of(Chouette::ObjectId) }
- # end
-
- it { is_expected.to belong_to(:stop_area_referential) }
- it { is_expected.to validate_presence_of :name }
- it { is_expected.to validate_numericality_of :latitude }
- it { is_expected.to validate_numericality_of :longitude }
+ describe '#objectid' do
+ subject { super().objectid }
+ it { should be_kind_of(Chouette::StifReflexObjectid) }
+ end
+
+ it { should belong_to(:stop_area_referential) }
+ it { should validate_presence_of :name }
+ it { should validate_numericality_of :latitude }
+ it { should validate_numericality_of :longitude }
# describe ".latitude" do
# it "should accept -90 value" do
diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb
index bd74a2d4c..304cb0184 100644
--- a/spec/models/chouette/time_table_spec.rb
+++ b/spec/models/chouette/time_table_spec.rb
@@ -14,6 +14,8 @@ describe Chouette::TimeTable, :type => :model do
describe "#merge! with time_table" do
let(:another_tt) { create(:time_table) }
let(:another_tt_periods_to_range) { another_tt.periods.map{|p| p.period_start..p.period_end } }
+ let(:dates) { another_tt.dates.map(&:date) }
+ let(:continuous_dates) { another_tt.continuous_dates.flatten.map(&:date) }
# Make sur we don't have overlapping periods or dates
before do
@@ -22,12 +24,19 @@ describe Chouette::TimeTable, :type => :model do
p.period_end = p.period_end + 1.year
end
another_tt.dates.each{| d| d.date = d.date + 1.year }
+ another_tt.save
end
it 'should merge dates' do
subject.dates.clear
subject.merge!(another_tt)
- expect(subject.dates.map(&:date)).to include(*another_tt.dates.map(&:date))
+ expect(subject.dates.map(&:date)).to match_array(dates - continuous_dates)
+ end
+
+ it 'should not merge continuous dates' do
+ subject.dates.clear
+ subject.merge!(another_tt)
+ expect(subject.dates.map(&:date)).not_to include(*continuous_dates)
end
it 'should merge periods' do
@@ -50,28 +59,42 @@ describe Chouette::TimeTable, :type => :model do
subject.merge!(another_tt)
expect(subject.dates.map(&:date)).to include(another_tt.dates.last.date)
end
+
+ it 'should remove date in_out false if other tt doesnt have them' do
+ subject.dates.create(in_out: false, date: Date.today + 5.day + 1.year)
+
+ expect {
+ subject.merge!(another_tt)
+ }.to change {subject.reload.excluded_days.count}.by(-1)
+ end
end
context "#merge! with calendar" do
let(:calendar) { create(:calendar, date_ranges: [Date.today + 1.year..Date.tomorrow + 1.year]) }
+ let(:another_tt) { calendar.convert_to_time_table }
+ let(:dates) { subject.dates.map(&:date) }
+ let(:continuous_dates) { subject.continuous_dates.flatten.map(&:date) }
it 'should merge calendar dates' do
subject.dates.clear
- subject.merge!(calendar.convert_to_time_table)
- expect(subject.dates.map(&:date)).to include(*calendar.dates)
+ subject.merge!(another_tt)
+ expect(subject.dates.map(&:date)).to match_array(dates - continuous_dates)
+ end
+
+ it 'should not merge calendar continuous dates' do
+ subject.dates.clear
+ subject.merge!(another_tt)
+ expect(subject.dates.map(&:date)).not_to include(*continuous_dates)
end
it 'should merge calendar periods with no periods in source' do
subject.periods.clear
- another_tt = calendar.convert_to_time_table
subject.merge!(another_tt)
expect(subject_periods_to_range).to include(*calendar.date_ranges)
end
it 'should add calendar periods with existing periods in source' do
- another_tt = calendar.convert_to_time_table
subject.merge!(another_tt)
-
expect(subject_periods_to_range).to include(*calendar.date_ranges)
end
end
@@ -1109,7 +1132,7 @@ end
- describe "#optimize_periods" do
+ describe "#optimize_overlapping_periods" do
before do
subject.periods.clear
subject.periods << Chouette::TimeTablePeriod.new(
@@ -1127,7 +1150,7 @@ end
subject.int_day_types = 4|8|16
end
it "should return 2 ordered periods" do
- periods = subject.optimize_periods
+ periods = subject.optimize_overlapping_periods
expect(periods.size).to eq(2)
expect(periods[0].period_start).to eq(Date.new(2014, 6, 1))
expect(periods[0].period_end).to eq(Date.new(2014, 6, 14))
diff --git a/spec/models/chouette/vehicle_journey_at_stop_spec.rb b/spec/models/chouette/vehicle_journey_at_stop_spec.rb
new file mode 100644
index 000000000..d999ed1a8
--- /dev/null
+++ b/spec/models/chouette/vehicle_journey_at_stop_spec.rb
@@ -0,0 +1,49 @@
+require 'spec_helper'
+
+RSpec.describe Chouette::VehicleJourneyAtStop, type: :model do
+ describe "#day_offset_outside_range?" do
+ let (:at_stop) { build_stubbed(:vehicle_journey_at_stop) }
+
+ it "disallows negative offsets" do
+ expect(at_stop.day_offset_outside_range?(-1)).to be true
+ end
+
+ it "disallows offsets greater than DAY_OFFSET_MAX" do
+ expect(at_stop.day_offset_outside_range?(
+ Chouette::VehicleJourneyAtStop::DAY_OFFSET_MAX + 1
+ )).to be true
+ end
+
+ it "allows offsets between 0 and DAY_OFFSET_MAX inclusive" do
+ expect(at_stop.day_offset_outside_range?(
+ Chouette::VehicleJourneyAtStop::DAY_OFFSET_MAX
+ )).to be false
+ end
+
+ it "forces a nil offset to 0" do
+ expect(at_stop.day_offset_outside_range?(nil)).to be false
+ end
+ end
+
+ describe "#validate" do
+ it "displays the proper error message when day offset exceeds the max" do
+ bad_offset = Chouette::VehicleJourneyAtStop::DAY_OFFSET_MAX + 1
+
+ at_stop = build_stubbed(
+ :vehicle_journey_at_stop,
+ arrival_day_offset: bad_offset,
+ departure_day_offset: bad_offset
+ )
+ error_message = I18n.t(
+ 'vehicle_journey_at_stops.errors.day_offset_must_not_exceed_max',
+ local_id: at_stop.vehicle_journey.objectid.local_id,
+ max: bad_offset
+ )
+
+ at_stop.validate
+
+ expect(at_stop.errors[:arrival_day_offset]).to include(error_message)
+ expect(at_stop.errors[:departure_day_offset]).to include(error_message)
+ end
+ end
+end
diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb
index c78ef5b33..645513735 100644
--- a/spec/models/chouette/vehicle_journey_spec.rb
+++ b/spec/models/chouette/vehicle_journey_spec.rb
@@ -1,7 +1,24 @@
require 'spec_helper'
describe Chouette::VehicleJourney, :type => :model do
- describe "vjas_departure_time_must_be_before_next_stop_arrival_time" do
+ it "must be valid with an at-stop day offset of 1" do
+ vehicle_journey = create(
+ :vehicle_journey,
+ stop_arrival_time: '23:00:00',
+ stop_departure_time: '23:00:00'
+ )
+ vehicle_journey.vehicle_journey_at_stops.last.update(
+ arrival_time: '00:30:00',
+ departure_time: '00:30:00',
+ arrival_day_offset: 1,
+ departure_day_offset: 1
+ )
+
+ expect(vehicle_journey).to be_valid
+ end
+
+ describe "vjas_departure_time_must_be_before_next_stop_arrival_time",
+ skip: "Validation currently commented out because it interferes with day offsets" do
let(:vehicle_journey) { create :vehicle_journey }
let(:vjas) { vehicle_journey.vehicle_journey_at_stops }
@@ -10,7 +27,7 @@ describe Chouette::VehicleJourney, :type => :model do
vehicle_journey.validate
expect(vjas[0].errors[:departure_time]).not_to be_blank
- expect(vehicle_journey.errors[:vehicle_journey_at_stops].count).to eq(1)
+ expect(vehicle_journey.errors.count).to eq(1)
expect(vehicle_journey).not_to be_valid
end
@@ -19,7 +36,7 @@ describe Chouette::VehicleJourney, :type => :model do
vehicle_journey.validate
expect(vjas[0].errors[:departure_time]).to be_blank
- expect(vehicle_journey.errors[:vehicle_journey_at_stops]).to be_empty
+ expect(vehicle_journey.errors).to be_empty
expect(vehicle_journey).to be_valid
end
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb
index 2390cc470..53eaa60a3 100644
--- a/spec/models/referential_spec.rb
+++ b/spec/models/referential_spec.rb
@@ -27,11 +27,12 @@ describe Referential, :type => :model do
context "Cloning referential" do
let(:clone) do
- Referential.new_from(ref, organisation: ref.organisation)
+ Referential.new_from(ref)
end
let(:saved_clone) do
clone.tap do |clone|
+ clone.organisation = ref.organisation
clone.metadatas.each do |metadata|
metadata.periodes = metadata.periodes.map { |period| Range.new(period.end+1, period.end+10) }
end
diff --git a/spec/models/time_table_combination_spec.rb b/spec/models/time_table_combination_spec.rb
index 3e60fa444..ee934f50d 100644
--- a/spec/models/time_table_combination_spec.rb
+++ b/spec/models/time_table_combination_spec.rb
@@ -8,30 +8,93 @@ describe TimeTableCombination, :type => :model do
describe '#continuous_dates' do
it 'should group continuous dates' do
dates = source.dates.where(in_out: true)
- expect(source.continuous_dates[0].count).to eq(dates.count)
+ expect(source.continuous_dates.flatten.count).to eq(dates.count)
- # 6 more continuous date, 1 isolated date
+ # 6 more continuous dates, 2 isolated dates
(10..15).each do |n|
source.dates.create(date: Date.today + n.day, in_out: true)
end
- source.dates.create(date: Date.today + 1.year, in_out: true)
+
+ (1..2).each do |n|
+ source.dates.create(date: Date.today + n.day + 1.year, in_out: true)
+ end
+
expect(source.reload.continuous_dates[1].count).to eq(6)
- expect(source.reload.continuous_dates[2].count).to eq(1)
+ expect(source.reload.continuous_dates[2].count).to eq(2)
end
end
describe '#convert_continuous_dates_to_periods' do
it 'should convert continuous dates to periods' do
+ source.dates.clear
+
(10..12).each do |n|
source.dates.create(date: Date.today + n.day, in_out: true)
end
- source.dates.create(date: Date.today + 1.year, in_out: true)
+
+ (1..3).each do |n|
+ source.dates.create(date: Date.today + n.day + 1.year, in_out: true)
+ end
expect {
source.reload.convert_continuous_dates_to_periods
}.to change {source.periods.count}.by(2)
- expect(source.reload.dates.where(in_out: true).count).to eq(1)
+ expect(source.reload.dates.where(in_out: true).count).to eq(0)
+ end
+ end
+
+ describe '#continuous_periods' do
+ it 'should group continuous periods' do
+ source.periods.clear
+
+ start_date = Date.today + 1.year
+ end_date = start_date + 10
+
+ # 6 more continuous dates, 2 isolated dates
+ 0.upto(4) do |i|
+ source.periods.create(period_start: start_date, period_end: end_date)
+ start_date = end_date + 1
+ end_date = start_date + 10
+ end
+
+ expect(source.reload.continuous_periods.flatten.count).to eq(5)
+ end
+ end
+
+ describe '#convert_continuous_periods_into_one' do
+ it 'should convert continuous periods into one' do
+ source.periods.clear
+
+ start_date = Date.today + 1.year
+ end_date = start_date + 10
+
+ # 6 more continuous dates, 2 isolated dates
+ 0.upto(4) do |i|
+ source.periods.create(period_start: start_date, period_end: end_date)
+ start_date = end_date + 1
+ end_date = start_date + 10
+ end
+
+ expect {
+ source.reload.convert_continuous_periods_into_one
+ }.to change {source.periods.count}.by(-4)
+ end
+ end
+
+ describe '#optimize_continuous_dates_and_periods' do
+ it 'should update period if timetable has in_date just before or after ' do
+ source.dates.clear
+ source.periods.clear
+
+ source.periods.create(period_start: Date.today, period_end: Date.today + 10.day)
+ source.dates.create(date: Date.today - 1.day, in_out: true)
+
+ expect {
+ source.periods = source.optimize_continuous_dates_and_periods
+ }.to change {source.dates.count}.by(-1)
+
+ expect(source.reload.periods.first.period_start).to eq(Date.today - 1.day)
end
end
@@ -129,4 +192,3 @@ describe TimeTableCombination, :type => :model do
end
end
end
-
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 6f98e5ce7..3a9ae37e9 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,6 +1,4 @@
-require 'spec_helper'
-
-describe User, :type => :model do
+RSpec.describe User, :type => :model do
# it { should validate_uniqueness_of :email }
# it { should validate_presence_of :name }
@@ -116,9 +114,11 @@ describe User, :type => :model do
end
context 'permissions' do
+ let( :all_permissions ){ Stif::PermissionTranslator.translate(%w{boiv:edit-offer}) }
+
it 'should give edit permissions to user if user has "edit offer" permission in portail' do
User.portail_sync
- expect(User.find_by(username: 'vlatka.pavisic').permissions).to include_all(User.edit_offer_permissions)
+ expect(User.find_by(username: 'vlatka.pavisic').permissions).to eq(all_permissions)
expect(User.find_by(username: 'pierre.vabre').permissions).to be_empty
end
end
diff --git a/spec/policies/referential_policy_spec.rb b/spec/policies/referential_policy_spec.rb
index 33d8e13e8..69d0eb17b 100644
--- a/spec/policies/referential_policy_spec.rb
+++ b/spec/policies/referential_policy_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe ReferentialPolicy, type: :policy do
# ------------------
permissions :clone? do
- it_behaves_like 'permitted policy and same organisation', 'referentials.create', archived: true
+ it_behaves_like 'permitted policy', 'referentials.create', archived: true
end
permissions :archive? do
diff --git a/spec/support/permissions.rb b/spec/support/permissions.rb
index a13010f65..fcf9ae9c4 100644
--- a/spec/support/permissions.rb
+++ b/spec/support/permissions.rb
@@ -15,6 +15,7 @@ module Support
%w[
access_points
connection_links
+ calendars
footnotes
journey_patterns
referentials