Sha256: d5c829a4285f0fe0490f50516139f96a9c4cbe65f6bf1761eed027d507985f03

Contents?: true

Size: 1.73 KB

Versions: 32

Compression:

Stored size: 1.73 KB

Contents

# -*- encoding : utf-8 -*-

shared_examples_for "machine input" do
  subject(:input) do
    myinput = create_machine_input_card
    myinput
  end

  let!(:machine) do
    f = create_machine_card
    f << create_machine_input_card
    f.putty
    f
  end
  let(:more_input) do
    moreinput = create_another_machine_input_card
    moreinput
  end

  context "when removed" do
    it "updates machine_input card of machine card" do
      machine
      Card::Auth.as_bot do
        input.delete!
      end
      ca = Card.gimme machine.name
      expect(ca.machine_input_card.item_cards).to eq([])
    end

    it "updates output of machine card" do
      machine
      Card::Auth.as_bot do
        input.delete!
      end
      f = Card.gimme machine.name
      path = f.machine_output_path
      expect(File.read(path)).to eq("")
    end
  end

  it "delivers machine input" do
    expect(input.machine_input).to eq(card_content[:out])
  end

  context "when updated" do
    it "updates output of related machine card" do
      input.putty content: card_content[:changed_in]
      updated_machine = Card.gimme machine.name
      path = updated_machine.machine_output_path
      expect(File.read(path)).to eq(card_content[:changed_out])
    end
  end

  context "when added" do
    it "updates output of related machine card" do
      if machine.is_a? Card::Set::Type::Pointer
        machine << more_input
        machine.putty
        updated_machine = Card.gimme machine.name
        path = updated_machine.machine_output_path
        out = if card_content[:added_out]
                card_content[:added_out]
              else
                ([card_content[:out]] * 2).join("\n")
              end
        expect(File.read(path)).to eq(out)
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
card-1.98.0 mod/machines/spec/shared_examples/machine_input.rb
card-1.97.0.1 mod/machines/spec/shared_examples/machine_input.rb
card-1.97.0 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.8 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.7 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.6 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.5 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.4 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.3 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.2 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.1 mod/machines/spec/shared_examples/machine_input.rb
card-1.96.0 mod/machines/spec/shared_examples/machine_input.rb
card-1.95.3 mod/machines/spec/shared_examples/machine_input.rb
card-1.95.2 mod/machines/spec/shared_examples/machine_input.rb
card-1.95.1 mod/machines/spec/shared_examples/machine_input.rb
card-1.95.0 mod/machines/spec/shared_examples/machine_input.rb
card-1.94.1 mod/machines/spec/shared_examples/machine_input.rb
card-1.94.0 mod/machines/spec/shared_examples/machine_input.rb
card-1.93.13 mod/machines/spec/shared_examples/machine_input.rb
card-1.93.12 mod/machines/spec/shared_examples/machine_input.rb