diff options
| author | Alban Peignier | 2017-12-28 08:50:56 +0100 |
|---|---|---|
| committer | Alban Peignier | 2017-12-28 08:56:05 +0100 |
| commit | da60766c207ac372e2ebd1d42be7c7b9c3ee4957 (patch) | |
| tree | deb871c934726bc2f2f8e039d6b229b960a49a9a /spec | |
| parent | df389a13dc90d6765123b58de0e5dcbc55704cc3 (diff) | |
| download | chouette-core-da60766c207ac372e2ebd1d42be7c7b9c3ee4957.tar.bz2 | |
Use current_organisation as begin_of_association_chain in Lines/Companies/Networks/GroupOfLinesController. Refs #5102
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/lines_controller_spec.rb | 4 | ||||
| -rw-r--r-- | spec/factories/line_referentials.rb | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/spec/controllers/lines_controller_spec.rb b/spec/controllers/lines_controller_spec.rb index ce5adbbdd..65fe88b96 100644 --- a/spec/controllers/lines_controller_spec.rb +++ b/spec/controllers/lines_controller_spec.rb @@ -1,14 +1,14 @@ RSpec.describe LinesController, :type => :controller do login_user - let(:line_referential) { create :line_referential } + let(:line_referential) { create :line_referential, member: @user.organisation } let(:line) { create :line, line_referential: line_referential } describe 'PUT deactivate' do let(:request){ put :deactivate, id: line.id, line_referential_id: line_referential.id } it 'should redirect to 403' do - expect(request).to redirect_to "/403" + expect(request).to redirect_to "/403" end with_permission "lines.change_status" do diff --git a/spec/factories/line_referentials.rb b/spec/factories/line_referentials.rb index e9e6dce5a..8c2aad646 100644 --- a/spec/factories/line_referentials.rb +++ b/spec/factories/line_referentials.rb @@ -2,5 +2,14 @@ FactoryGirl.define do factory :line_referential do sequence(:name) { |n| "Line Referential #{n}" } objectid_format 'stif_codifligne' + + transient do + member nil + end + + after(:create) do |line_referential, evaluator| + line_referential.add_member evaluator.member if evaluator.member + line_referential.save + end end end |
