diff options
| author | Teddy Wing | 2018-02-09 18:16:24 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-02-09 18:16:24 +0100 | 
| commit | c259d7e3e24259e14b4756f181b3a8784d8d1919 (patch) | |
| tree | 6a4f684539c5c8e7eb09e3853732bee4b2592f07 /spec/factories | |
| parent | 42cff5c818140b193eb90fbb40b31e8a0c708207 (diff) | |
| download | chouette-core-c259d7e3e24259e14b4756f181b3a8784d8d1919.tar.bz2 | |
route_base_spec.rb: Fix checksum test as a result of factory
* The factory already creates `StopPoint`s for us, so we don't need to
  create any additional ones in the test. Previously this would give us
  eight stop points instead of three or five.
* Update the checksum in the factory after generating stop points. We
  need to do this because otherwise the checksum will be incorrect, not
  taking into account the new stop points. Without this change, the
  checksum starts out in an inconsistent state and causes the:
      1) Chouette::Route checksum behaves like checksum support doesn't change the checksum on save if the source hasn't been changed
         Failure/Error: expect(subject.checksum).to eq(checksum)
           expected: "bc0e7b37243682904bd7013108258fdc744b03e0c59ed1a30e24e112a49242c1"
                got: "b39d643fdd4f9d6ff62547750508af728a187de29a3d6e4295f9bb3d13559a51"
           (compared using ==)
         Shared Example Group: "checksum support" called from ./spec/models/chouette/route/route_base_spec.rb:5
         # ./spec/support/checksum_support.rb:84:in `block (2 levels) in <top (required)>'
  test to fail.
Refs #5416
Diffstat (limited to 'spec/factories')
| -rw-r--r-- | spec/factories/chouette_routes.rb | 1 | 
1 files changed, 1 insertions, 0 deletions
| diff --git a/spec/factories/chouette_routes.rb b/spec/factories/chouette_routes.rb index 7443d08bc..92a50b924 100644 --- a/spec/factories/chouette_routes.rb +++ b/spec/factories/chouette_routes.rb @@ -19,6 +19,7 @@ FactoryGirl.define do        after(:create) do |route, evaluator|          create_list(:stop_point, evaluator.stop_points_count, route: route)          route.reload +        route.update_checksum!        end        factory :route_with_journey_patterns do | 
