module BandFactory def create_band_params(options = {}) opts = { :songs => 1, :name => 'Band name', :contact_name => 'Contact Name', :contact_addr => "Streetname 666\n1234Someplace Nice", :contact_phone => '98765432', :contact_email => 'band@example.com' }.merge(options) num_songs = opts.delete(:songs) params = { 'name' => opts[:name], 'city' => 'Oslo', 'website' => 'http://imbalance.no', 'label' => 'Calculated Imperfection', 'shortbio' => 'Thrash metal from Norway', 'contact' => { 'name' => opts[:contact_name], 'addr' => opts[:contact_addr], 'phone' => opts[:contact_phone], 'email' => opts[:contact_email] }, 'members' => { '1' => { 'name' => 'Harald Eilertsen', 'instrument' => 'Bass/Vocals', 'age' => '' }, '2' => { 'name' => 'Welle', 'instrument' => 'Drums', 'age' => '' }, '3' => { 'name' => 'Thormodr', 'instrument' => 'Guitar', 'age' => '' } }, 'songs' => {} } (1..num_songs).each do |i| num = i.to_s params['songs'][num] = create_song_params end params end def create_song_params { 'title' => 'Bestial by Nature', 'time' => '02:80', 'isrc' => '', 'performers' => "Harald Eilertsen\nThormod Steinert\nLars Welle", 'composers' => "Harald Eilertsen\nThormod Steinert", 'notes' => 'Rævrukkje rum kjurr!' } end end