X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/15689af6bfa6220b9c539eb0717a3d75cc3c4799..cc65b2d126d708499edb5fb5d513266cfa33a47b:/test/factories/traces.rb?ds=sidebyside diff --git a/test/factories/traces.rb b/test/factories/traces.rb index 3f409b367..66f810468 100644 --- a/test/factories/traces.rb +++ b/test/factories/traces.rb @@ -12,5 +12,20 @@ FactoryGirl.define do trait :deleted do visible false end + + transient do + fixture nil + end + + after(:create) do |trace, evaluator| + if evaluator.fixture + File.symlink(Rails.root.join("test", "gpx", "fixtures", "#{evaluator.fixture}.gpx"), + Rails.root.join("test", "gpx", "traces", "#{trace.id}.gpx")) + File.symlink(Rails.root.join("test", "gpx", "fixtures", "#{evaluator.fixture}.gif"), + Rails.root.join("test", "gpx", "images", "#{trace.id}.gif")) + File.symlink(Rails.root.join("test", "gpx", "fixtures", "#{evaluator.fixture}_icon.gif"), + Rails.root.join("test", "gpx", "images", "#{trace.id}_icon.gif")) + end + end end end