Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Factory.define :song do |f|
- f.song_content_type 'audio/mp3'
- f.song_file_name {Factory.next(:mp3_filename)}
- f.name {Factory.next(:title)}
- f.association :artist
- f.association :album
- f.purchase_option { FREE }
- f.retail_price {Factory.next(:song_price)}
- f.test_song false
- f.isrc {Factory.next(:string)}
- f.genre_list {Factory.next(:genre_list)}
- f.sounds_like_list {Factory.next(:sounds_like_list)}
- f.feels_like_list {Factory.next(:feels_like_list)}
- f.influenced_by_list {Factory.next(:influenced_by_list)}
- f.after_build { |a|
- unless a.song_file_name == 'song_test.mp3'
- tmp = Tempfile.new(a.song_file_name).open do |f|
- f.puts(File.read(RAILS_ROOT + '/db/faker/songs/' + a.song_file_name))
- end
- a.song = tmp
- end
- }
- end
Add Comment
Please, Sign In to add comment