aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/calendars_controller.rb2
-rw-r--r--spec/features/calendars_spec.rb16
2 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb
index 2f25d95d6..a6f31eead 100644
--- a/app/controllers/calendars_controller.rb
+++ b/app/controllers/calendars_controller.rb
@@ -104,7 +104,7 @@ class CalendarsController < ChouetteController
end
end
- def begin_of_chain
+ def begin_of_association_chain
current_organisation
end
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