]> git.openstreetmap.org Git - rails.git/blob - test/factories/notes.rb
Revert to using released version of canonical-rails
[rails.git] / test / factories / notes.rb
1 FactoryBot.define do
2   factory :note do
3     latitude { 1 * GeoRecord::SCALE }
4     longitude { 1 * GeoRecord::SCALE }
5     # tile { QuadTile.tile_for_point(1,1) }
6
7     trait :closed do
8       transient do
9         closed_by { nil }
10       end
11
12       status { "closed" }
13       closed_at { Time.now.utc }
14
15       after(:create) do |note, context|
16         create(:note_comment, :author => context.closed_by, :body => "Closing comment", :event => "closed", :note => note)
17       end
18     end
19
20     factory :note_with_comments do
21       transient do
22         comments_count { 1 }
23       end
24
25       after(:create) do |note, evaluator|
26         create_list(:note_comment, evaluator.comments_count, :note => note)
27       end
28     end
29   end
30 end