aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/helpers
diff options
context:
space:
mode:
authorRobert2017-08-14 18:42:08 +0200
committerRobert2017-08-15 17:22:34 +0200
commit373a4089173795d011ebd6adf7382b2a5e40a51b (patch)
tree1f5580f5d57f08b7361a19b21a161ac98b04d255 /spec/support/helpers
parentc16c03b91174cf637e0bd2f0e3336e3788f43e59 (diff)
downloadchouette-core-373a4089173795d011ebd6adf7382b2a5e40a51b.tar.bz2
Refs: #4189@2h; Iimplementation of Chouette::Route#duplicate & Chouette::StopPoint#duplicate
With the following unspecified behaviour concerning `objectid` and `object_version` - The duplicated Route objectid is passed into Route#duplicate - The duplicated StopPoint objectids are constructed from the source's objectids (parts 2 & 3) and the route's objectid (part 1) - the duplicated Route object_version equals the source's one
Diffstat (limited to 'spec/support/helpers')
-rw-r--r--spec/support/helpers/model_compare_helpers.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/support/helpers/model_compare_helpers.rb b/spec/support/helpers/model_compare_helpers.rb
new file mode 100644
index 000000000..97e26f300
--- /dev/null
+++ b/spec/support/helpers/model_compare_helpers.rb
@@ -0,0 +1,12 @@
+module Support::ModelCompareHelpers
+
+ def values_for_create obj, except: []
+ keys = obj.attributes.keys - except - %w{id created_at updated_at}
+ obj.attributes.slice(*keys)
+ end
+
+end
+
+RSpec.configure do | rspec |
+ rspec.include Support::ModelCompareHelpers, type: :model
+end