Sha256: b82f7de56d4e1192c7e7aaa8c18ebe1208c0d96fa469b4f4601144647e37d658

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper.rb'

describe RFlow::Component::Port do
  it "should not be connected" do
    described_class.new.connected?.should be_false
  end
end

describe RFlow::Component::HashPort do
  it "should not be connected" do
    port_config = double('Port Config')
    port_config.should_receive(:name).and_return('port')
    port_config.should_receive(:uuid).and_return('1')

    port = described_class.new(port_config)
    port.connected?.should be_false
  end
end

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

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

      port = described_class.new(port_config)
      port.add_connection(nil, connection_double)

      port.connected?.should be_false
      port.connect!
      port.connected?.should be_true
    end
  end
end

describe RFlow::Component::OutputPort do
  context ".connect!" do
    it "shouldbe connected" do
      connection_double = double('connection')
      connection_double.should_receive(:connect_output!)

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

      port = described_class.new(port_config)
      port.add_connection(nil, connection_double)

      port.connected?.should be_false
      port.connect!
      port.connected?.should be_true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rflow-1.0.0a1 spec/rflow_component_port_spec.rb