scube-server/spec/lib/streamer_spec.rb
Thibault Jouan 2f6a447416 Implement track/stream
* Add Streamer class
* Use FactoryGirl for factories
* Add sha256 field to tracks
* Add mime_type field to tracks
2011-07-26 16:59:47 +00:00

20 lines
453 B
Ruby

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