Implement track/stream

* Add Streamer class
* Use FactoryGirl for factories
* Add sha256 field to tracks
* Add mime_type field to tracks
This commit is contained in:
Thibault Jouan
2011-07-23 16:30:51 +00:00
parent 47fa969617
commit 2f6a447416
18 changed files with 166 additions and 51 deletions

19
spec/lib/streamer_spec.rb Normal file
View File

@@ -0,0 +1,19 @@
require 'spec_helper'
describe Streamer do
describe '#each' do
let(:stream) { Streamer.new("#{Rails.root}/spec/fixtures/test.mp3") }
it 'returns file content' do
chunks = ''
stream.each { |c| chunks << c }
chunks.should == File.read("#{Rails.root}/spec/fixtures/test.mp3")
end
it 'returns content in multiple chunks' do
count = 0
stream.each { count += 1 }
count.should be >= 2
end
end
end