Sha256: bb69bc8134a8974a6c39e1131229db77fa43d18fea9f4fe53ad261d8296a369e

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

class RFlow
  class Component
    describe Port do
      it "should not be connected" do
        expect(described_class.new(nil)).not_to be_connected
      end
    end

    describe HashPort do
      it "should not be connected" do
        expect(described_class.new(nil)).not_to be_connected
      end
    end

    describe InputPort do
      context "#connect!" do
        it "should be connected" do
          connection = double('connection')
          allow(connection).to receive(:name)
          allow(connection).to receive(:uuid)
          allow(connection).to receive(:input_port_key)
          expect(connection).to receive(:connect_input!)

          described_class.new(nil).tap do |port|
            port.add_connection(nil, connection)
            expect(port).not_to be_connected
            port.connect!
            expect(port).to be_connected
          end
        end
      end
    end

    describe OutputPort do
      context "#connect!" do
        it "should be connected" do
          connection = double('connection')
          allow(connection).to receive(:name)
          allow(connection).to receive(:uuid)
          allow(connection).to receive(:input_port_key)
          expect(connection).to receive(:connect_output!)

          described_class.new(nil).tap do |port|
            port.add_connection(nil, connection)
            expect(port).not_to be_connected
            port.connect!
            expect(port).to be_connected
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rflow-1.0.0a4 spec/rflow/component/port_spec.rb
rflow-1.0.0a3 spec/rflow/component/port_spec.rb