aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/workbench_spec.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-09-25 16:17:04 +0200
committerTeddy Wing2017-09-25 16:56:10 +0200
commit72806a4961e4240cff955c66fff1840e40301b89 (patch)
treec9caf1d9634a5665d9bd05c3d10121a145b09a4e /spec/models/workbench_spec.rb
parent972cbb129747feb15c3c6c5ab5eabea2d7c045e1 (diff)
downloadchouette-core-72806a4961e4240cff955c66fff1840e40301b89.tar.bz2
Workbench: Validate presence of `output`
Ensure all workbenches always have an associated `ReferentialSuite` by validating presence of the `output` attribute. In order to pass the 'should have a valid factory' test, we need to define a `ReferentialSuite` factory and set up a default association on `output` in the `Workbench` factory. We also need to add set `output` when creating a `Workbench` in `spec/support/referential.rb`, otherwise we get a validation error that breaks the tests. Clean up the formatting of that call. In order to pass a `ReferentialSuite`, I just create one above, but I'm not sure if I should be using a `find_or_create` mechanism like the other associated objects do above. Refs #3520
Diffstat (limited to 'spec/models/workbench_spec.rb')
-rw-r--r--spec/models/workbench_spec.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/spec/models/workbench_spec.rb b/spec/models/workbench_spec.rb
index 617f34bb1..f83342f75 100644
--- a/spec/models/workbench_spec.rb
+++ b/spec/models/workbench_spec.rb
@@ -20,6 +20,8 @@ RSpec.describe Workbench, :type => :model do
it { should have_many(:stop_areas).through(:stop_area_referential) }
+ it { should validate_presence_of(:output) }
+
context '.lines' do
let!(:ids) { ['STIF:CODIFLIGNE:Line:C00840', 'STIF:CODIFLIGNE:Line:C00086'] }
let!(:organisation) { create :organisation, sso_attributes: { functional_scope: ids.to_json } }