aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/features/calendars_permissions_spec.rb4
-rw-r--r--spec/features/calendars_spec.rb16
-rw-r--r--spec/support/referential.rb12
3 files changed, 30 insertions, 2 deletions
diff --git a/spec/features/calendars_permissions_spec.rb b/spec/features/calendars_permissions_spec.rb
index 4857592d5..656c0dd78 100644
--- a/spec/features/calendars_permissions_spec.rb
+++ b/spec/features/calendars_permissions_spec.rb
@@ -1,8 +1,8 @@
RSpec.describe 'Calendars', type: :feature do
login_user
- let(:calendar) { create :calendar, organisation_id: 1 }
- let(:workgroup) { calendar.workgroup }
+ let(:calendar) { create :calendar, organisation: first_organisation, workgroup: first_workgroup }
+ let(:workgroup) { first_workgroup }
describe 'permissions' do
before do
diff --git a/spec/features/calendars_spec.rb b/spec/features/calendars_spec.rb
new file mode 100644
index 000000000..26220746b
--- /dev/null
+++ b/spec/features/calendars_spec.rb
@@ -0,0 +1,16 @@
+RSpec.describe 'Calendars', type: :feature do
+ login_user
+
+ let(:calendar1) { create(:calendar, workgroup: @user.organisation.workgroups.first, organisation: @user.organisation) }
+ let(:calendar2) { create(:calendar) }
+
+ describe "index" do
+ before(:each) do
+ visit workgroup_calendars_path(calendar1.workgroup)
+ end
+ it "should only display calendars from same workgroup" do
+ expect(page).to have_content calendar1.name
+ expect(page).to_not have_content calendar2.name
+ end
+ end
+end \ No newline at end of file
diff --git a/spec/support/referential.rb b/spec/support/referential.rb
index 9acdce73a..b50844ae4 100644
--- a/spec/support/referential.rb
+++ b/spec/support/referential.rb
@@ -8,6 +8,10 @@ module ReferentialHelper
Organisation.find_by!(code: "first")
end
+ def first_workgroup
+ Workgroup.find_by_name('IDFM')
+ end
+
def self.included(base)
base.class_eval do
extend ClassMethods
@@ -53,10 +57,18 @@ RSpec.configure do |config|
referential.add_member organisation, owner: true
end
+ workgroup = FactoryGirl.create(
+ :workgroup,
+ name: "IDFM",
+ line_referential: line_referential,
+ stop_area_referential: stop_area_referential
+ )
+
workbench = FactoryGirl.create(
:workbench,
name: "Gestion de l'offre",
organisation: organisation,
+ workgroup: workgroup,
line_referential: line_referential,
stop_area_referential: stop_area_referential
)