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:
19
spec/lib/streamer_spec.rb
Normal file
19
spec/lib/streamer_spec.rb
Normal 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
|
Reference in New Issue
Block a user