scube-server/spec/integration/tracks_spec.rb
Thibault Jouan f49a5a3f67 Update to rails 3.1.0
* Bump rails version to 3.1.0 in Gemfile
* Update config files
* Fix bcrypt monkey patch for specs
* Fix TracksController
* Replace track streaming with track download
* Remove assets from application layout
2011-09-15 16:10:21 +00:00

45 lines
991 B
Ruby

require 'spec_helper'
feature 'Tracks' do
include UserIntegrationHelpers
background do
sign_in
end
scenario 'shows track' do
track = Factory.create(:track, :name => 'Mega song')
visit track_path(track)
page.should have_content('Mega song')
end
scenario 'creates track' do
visit root_path
click_link 'Add a track'
fill_in 'Name', :with => 'Mega song'
attach_file 'File', File.expand_path('spec/fixtures/test.mp3')
click_button 'Upload'
current_path.should == track_path(Track.find(:first))
page.should have_content('Mega song')
end
scenario 'plays track' do
track = Factory.create(:track, :name => 'Mega song')
file = File.new("#{Rails.root}/spec/fixtures/test.mp3")
track.save_with_file(file, 'audio/mpeg')
visit track_path(track)
page.should have_xpath "//audio[@src='#{download_track_path(track)}']"
visit find('audio')[:src]
end
after do
`rm -f #{Rails.root}/data/tracks/*`
end
end