aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2018-03-30 08:22:13 +0200
committerGitHub2018-03-30 08:22:13 +0200
commitafbe88e752f3c5e7eadfcf1ab53c740b60334779 (patch)
tree570e5d639715c810d2342efe0ec08ce9b936f933
parentbfb5d47aa682bd67f70509d18d3e76ab96c013c5 (diff)
parent1b42ed84a5ac4394b1d135127c98194d073f025c (diff)
downloadchouette-core-afbe88e752f3c5e7eadfcf1ab53c740b60334779.tar.bz2
Merge pull request #397 from af83/6258-calendar-workgroup
Refs #6258 associate calendars with current organisation
-rw-r--r--app/controllers/calendars_controller.rb4
-rw-r--r--spec/features/calendars_spec.rb16
2 files changed, 20 insertions, 0 deletions
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb
index 3d88e4910..adb3b4764 100644
--- a/app/controllers/calendars_controller.rb
+++ b/app/controllers/calendars_controller.rb
@@ -104,6 +104,10 @@ class CalendarsController < ChouetteController
end
end
+ def begin_of_association_chain
+ current_organisation
+ end
+
def ransack_contains_date
date =[]
if params[:q] && !params[:q]['contains_date(1i)'].empty?
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