diff options
| author | Teddy Wing | 2017-09-25 16:17:04 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-09-25 16:56:10 +0200 |
| commit | 72806a4961e4240cff955c66fff1840e40301b89 (patch) | |
| tree | c9caf1d9634a5665d9bd05c3d10121a145b09a4e /spec/support/referential.rb | |
| parent | 972cbb129747feb15c3c6c5ab5eabea2d7c045e1 (diff) | |
| download | chouette-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/support/referential.rb')
| -rw-r--r-- | spec/support/referential.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/support/referential.rb b/spec/support/referential.rb index 3b74cb639..9c7108eb9 100644 --- a/spec/support/referential.rb +++ b/spec/support/referential.rb @@ -52,7 +52,15 @@ RSpec.configure do |config| referential.add_member organisation, owner: true end - workbench = Workbench.create!(:name => "Gestion de l'offre", organisation: organisation, line_referential: line_referential, stop_area_referential: stop_area_referential) + referential_suite = ReferentialSuite.create + + workbench = Workbench.create!( + name: "Gestion de l'offre", + organisation: organisation, + line_referential: line_referential, + stop_area_referential: stop_area_referential, + output: referential_suite + ) referential = Referential.create! prefix: "first", name: "first", slug: "first", organisation: organisation, workbench: workbench end |
