Sha256: 73a56f14ece10581fa73da4682bd88ec239471a8bceb8899fe6d9c69789e32e6

Contents?: true

Size: 1.6 KB

Versions: 15

Compression:

Stored size: 1.6 KB

Contents

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
      f = Card.gimme machine.name
      expect(f.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.cardname
      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.cardname
      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.kind_of? Card::Set::Type::Pointer
        machine << more_input
        machine.putty
        updated_machine  = Card.gimme machine.cardname
        path = updated_machine.machine_output_path
        expect(File.read path).to eq( ([card_content[:out]]*2).join("\n"))
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
wagn-1.14.9 mod/03_machines/spec/lib/shared_machine_input_examples.rb
wagn-1.14.8 mod/03_machines/spec/lib/shared_machine_input_examples.rb
wagn-1.14.7 mod/03_machines/spec/lib/shared_machine_input_examples.rb
wagn-1.14.6 mod/03_machines/spec/lib/shared_machine_input_examples.rb
wagn-1.14.5 mod/03_machines/spec/lib/shared_machine_input_examples.rb
wagn-1.14.4 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.14.3 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.14.2 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.14.1 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.14.0 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.14.0.pre3 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.14.0.pre2 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.14.0.pre1 mod/03_machines/spec/lib/machine_input_spec.rb
wagn-1.13.0 spec/mod/standard/lib/machine_input_spec.rb
wagn-1.13.0.pre2 spec/mods/standard/lib/machine_input_spec.rb