Sha256: c02304a3081cb2c3b83fd2757b3e61116e165210e81a2a75b734d5c8edef2ae6

Contents?: true

Size: 1003 Bytes

Versions: 5

Compression:

Stored size: 1003 Bytes

Contents

describe NetworkExecutive::Station::LocalAffiliate do
  describe '#initialize' do
    it 'should run the Producer on the next tick' do
      EM.stub( :next_tick ).and_yield

      NetworkExecutive::Producer.should_receive( :run! )

      described_class.new
    end
  end

  describe '#call' do
    before { EM.stub( :next_tick ) }

    let(:env) { double('env').as_null_object }

    subject { described_class.new.call( env ) }

    context 'with a request that accepts event streams' do
      before do
        Faye::EventSource.stub( :eventsource? ).and_return true
      end

      it 'should change the channel for the Viewer' do
        NetworkExecutive::Viewer.should_receive( :change_channel ).with env

        subject
      end
    end

    context 'with a request that does not accept event streams' do
      before do
        Faye::EventSource.stub( :eventsource? ).and_return false
      end

      it 'should return a 403' do
        subject.first.should == 403
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
network_executive-0.0.8 spec/unit/station/local_affiliate_spec.rb
network_executive-0.0.7 spec/unit/station/local_affiliate_spec.rb
network_executive-0.0.4 spec/unit/station/local_affiliate_spec.rb
network_executive-0.0.3 spec/unit/station/local_affiliate_spec.rb
network_executive-0.0.2 spec/unit/station/local_affiliate_spec.rb