Sha256: 215222f867054ca2bcc27f7de1f9a7b51be5f4ec4f919bbe6129fd0d1694eeb6

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require 'torkify/listener'

module Torkify
  describe Listener do
    before do
      Torkify::Reader.stub(:new)
      Torkify::Conductor.any_instance.stub(:start)
    end

    context "with default command and directory" do
      before do
        @command = 'tork-remote tork-engine'
        @dir = Dir.pwd
      end
      subject { Listener.new @command, @dir }

      it "should create a reader with those defaults" do
        Torkify::Reader.should_receive(:new).with @command, @dir
        subject.start
      end
    end

    context "with alternative command and directory" do
      before do
        @command = 'the command'
        @dir = 'the dir'
      end

      subject { Listener.new @command, @dir }

      it "should create a reader with the given parameters" do
        Torkify::Reader.should_receive(:new).with @command, @dir
        subject.start
      end
    end

    it { should respond_to :add_observer }

    context "after adding an observer" do
      before do
        @listener = Listener.new
      end

      subject { @listener.add_observer double }

      it { should be @listener }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
torkify-0.0.3 spec/listener_spec.rb
torkify-0.0.2 spec/listener_spec.rb
torkify-0.0.1 spec/listener_spec.rb