Guest User

Untitled

a guest
May 26th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Factory.define :song do |f|
  2. f.song_content_type 'audio/mp3'
  3. f.song_file_name {Factory.next(:mp3_filename)}
  4. f.name {Factory.next(:title)}
  5. f.association :artist
  6. f.association :album
  7. f.purchase_option { FREE }
  8. f.retail_price {Factory.next(:song_price)}
  9. f.test_song false
  10. f.isrc {Factory.next(:string)}
  11. f.genre_list {Factory.next(:genre_list)}
  12. f.sounds_like_list {Factory.next(:sounds_like_list)}
  13. f.feels_like_list {Factory.next(:feels_like_list)}
  14. f.influenced_by_list {Factory.next(:influenced_by_list)}
  15. f.after_build { |a|
  16. unless a.song_file_name == 'song_test.mp3'
  17. tmp = Tempfile.new(a.song_file_name).open do |f|
  18. f.puts(File.read(RAILS_ROOT + '/db/faker/songs/' + a.song_file_name))
  19. end
  20. a.song = tmp
  21. end
  22. }
  23. end
Add Comment
Please, Sign In to add comment