Sha256: efcadabb2d9c4a404a78ed9a540b8035863d658cfa8fc401c32b8abb4ef98604
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
describe NetworkExecutive::Channel do let(:klass) do Class.new described_class end before do stub_const 'MyChannel', klass end subject { MyChannel.new } its(:name) { should == 'my_channel' } its(:display_name) { should == 'my channel' } its(:to_s) { should == 'my channel' } describe '#show' do context 'for a program that exists' do let(:scheduled_double) { double('program', program_name:'name') } let(:program_double) { double('program') } it 'should play the program' do NetworkExecutive::Program.stub( :find_by_name ).and_return program_double program_double.should_receive :play described_class.any_instance.should_receive :push subject.show scheduled_double end end context 'for a program that does not exist' do it 'should raise a ProgramNotFoundError' do program = double('scheduled_program', program_name:'noop') expect{ subject.show program }.to raise_error NetworkExecutive::ProgramNotFoundError end end end describe '.find_by_name' do it 'should find a program by name' do NetworkExecutive::Network.channels.should_receive( :find ) described_class.find_by_name 'foo' end end describe '.inherited' do it 'should register the channel with the Network' do NetworkExecutive::Network.channels.first.should be_a MyChannel end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
network_executive-0.0.4 | spec/models/channel_spec.rb |
network_executive-0.0.3 | spec/models/channel_spec.rb |
network_executive-0.0.2 | spec/models/channel_spec.rb |