aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/referential.rb
diff options
context:
space:
mode:
authorAlban Peignier2016-11-19 19:42:03 +0100
committerAlban Peignier2016-11-19 19:59:24 +0100
commitbc1ec22d68233c74cbc93b2810f4e479a5e4b5ff (patch)
treee2a21878c6c7b3fa986b1f688610035f551f356a /spec/support/referential.rb
parenta3482213380844cdea5c75f6f6e84267b6c72135 (diff)
downloadchouette-core-bc1ec22d68233c74cbc93b2810f4e479a5e4b5ff.tar.bz2
Use code to define and find 'first' Organisation in specs. Refs #1782
Diffstat (limited to 'spec/support/referential.rb')
-rw-r--r--spec/support/referential.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/support/referential.rb b/spec/support/referential.rb
index 03f5a0977..57b510f69 100644
--- a/spec/support/referential.rb
+++ b/spec/support/referential.rb
@@ -1,7 +1,11 @@
module ReferentialHelper
def first_referential
- Referential.where(:slug => "first").take!
+ Referential.find_by!(:slug => "first")
+ end
+
+ def first_organisation
+ Organisation.find_by!(code: "first")
end
def self.included(base)
@@ -38,7 +42,7 @@ RSpec.configure do |config|
# Truncating doesn't drop schemas, ensure we're clean here, first *may not* exist
Apartment::Tenant.drop('first') rescue nil
# Create the default tenant for our tests
- organisation = Organisation.create!(:name => "first")
+ organisation = Organisation.create!(code: "first", name: "first")
line_referential = LineReferential.find_or_create_by(name: "first") do |referential|
referential.add_member organisation, owner: true
@@ -48,7 +52,7 @@ RSpec.configure do |config|
end
workbench = Workbench.create!(:name => "first", organisation: organisation, line_referential: line_referential, stop_area_referential: stop_area_referential)
- Referential.create! prefix: "first", name: "first", slug: "first", organisation: organisation, workbench: workbench
+ referential = Referential.create! prefix: "first", name: "first", slug: "first", organisation: organisation, workbench: workbench
end
config.before(:each) do