Sha256: 083d1febc70f7cfe87c93dbf1174246eb04eadbdf3e0ab3c4c3b39b324211c78

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

class RFlow
  class Component
    describe Port do
      it "should not be connected" do
        described_class.new.should_not be_connected
      end
    end

    describe HashPort do
      it "should not be connected" do
        config = double('Port Config')
        config.stub(:name).and_return('port')
        config.stub(:uuid).and_return('1')

        described_class.new(config).should_not be_connected
      end
    end

    describe InputPort do
      context "#connect!" do
        it "should be connected" do
          connection = double('connection')
          connection.should_receive(:connect_input!)

          config = double('Port Config')
          config.stub(:name).and_return('port')
          config.stub(:uuid).and_return('1')

          described_class.new(config).tap do |port|
            port.add_connection(nil, connection)
            port.should_not be_connected
            port.connect!
            port.should be_connected
          end
        end
      end
    end

    describe OutputPort do
      context "#connect!" do
        it "should be connected" do
          connection = double('connection')
          connection.should_receive(:connect_output!)

          port_config = double('Port Config')
          port_config.stub(:name).and_return('port')
          port_config.stub(:uuid).and_return('1')

          described_class.new(port_config).tap do |port|
            port.add_connection(nil, connection)
            port.should_not be_connected
            port.connect!
            port.should be_connected
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rflow-1.0.0a2 spec/rflow/component/port_spec.rb