Sha256: 92df63f572e999bfdbb7778b1b205eae1c4046efd8681e63c744e34a86279130

Contents?: true

Size: 889 Bytes

Versions: 16

Compression:

Stored size: 889 Bytes

Contents

  require 'factory_girl'

FactoryGirl.define do
  factory :artist do
    sequence(:name) {|n| "Artist ##{n}" }
    sequence(:website) {|n| "http://website#{n}.com/" }

    factory :artist_with_albums do
      ignore do
        album_count 3
      end

      after(:create) do |artist, evaluator|
        create_list(:album_with_songs, evaluator.album_count, artist: artist)
      end
    end
  end

  factory :album do
    sequence(:title) {|n| "Album ##{n}" }
    sequence(:year) {|n| 1960 + n }
    artist

    factory :album_with_songs do
      ignore do
        song_count 10
      end

      after(:create) do |album, evaluator|
        create_list(:song, evaluator.song_count, album: album, artist: album.artist)
      end
    end
  end

  factory :song do
    sequence(:title) {|n| "Song ##{n}" }
    artist
    album
  end

  factory :payment do
    amount 999
    artist
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
restpack_serializer-0.4.2 spec/support/factory.rb
restpack_serializer-0.4.1 spec/support/factory.rb
restpack_serializer-0.2.16 spec/support/factory.rb
restpack_serializer-0.2.15 spec/support/factory.rb
restpack_serializer-0.2.14 spec/support/factory.rb
restpack_serializer-0.2.13 spec/support/factory.rb
restpack_serializer-0.2.12 spec/support/factory.rb
restpack_serializer-0.2.11 spec/support/factory.rb
restpack_serializer-0.2.10 spec/support/factory.rb
restpack_serializer-0.2.9 spec/support/factory.rb
restpack_serializer-0.2.8 spec/support/factory.rb
restpack_serializer-0.2.7 spec/support/factory.rb
restpack_serializer-0.2.6 spec/support/factory.rb
restpack_serializer-0.2.5 spec/support/factory.rb
restpack_serializer-0.2.4 spec/support/factory.rb
restpack_serializer-0.2.3 spec/support/factory.rb