Sha256: ee3e2c54eae47e47d176dd1135f83d9cb9f49f31ff8f5f41e4327adca3231dc1
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' require 'builder' describe Radiodan::Builder do before :each do @player = mock Radiodan::Player.stub(:new).and_return(@player) end it 'passes a playlist to the player' do playlist = mock @player.should_receive(:playlist=).with(playlist) builder = Radiodan::Builder.new do |b| b.playlist playlist end end it 'passes an instance of an adapter class with options to the player' do class Radiodan::MockAdapter; end adapter, options = mock, mock Radiodan::MockAdapter.should_receive(:new).with(options).and_return(adapter) @player.should_receive(:adapter=).with(adapter) builder = Radiodan::Builder.new do |b| b.adapter :mock_adapter, options end end describe 'middleware' do it 'creates an instance of middleware and stores internally' do class Radiodan::MockMiddle; end options, middleware = mock, mock Radiodan::MockMiddle.should_receive(:new).with(options).and_return(middleware) builder = Radiodan::Builder.new do |b| b.use :mock_middle, options end builder.middleware.size.should == 1 builder.middleware.should include middleware end it 'executes middleware, passing player instance' do middleware = stub middleware.should_receive(:call).with(@player) builder = Radiodan::Builder.new builder.should_receive(:middleware).and_return([middleware]) builder.call_middleware! end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radiodan-0.0.4 | spec/lib/builder_spec.rb |
radiodan-0.0.3 | spec/lib/builder_spec.rb |
radiodan-0.0.2 | spec/lib/builder_spec.rb |