Sha256: 377eeeb8e514dd6a050924d2624a4e4e937ea9b08e23e94b1772a63e98440582

Contents?: true

Size: 886 Bytes

Versions: 12

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'
require "vagrant-ovirt4/action/is_running"

describe VagrantPlugins::OVirtProvider::Action::IsRunning do
  let(:app) { lambda { |env| } }
  let(:env) {
     OpenStruct.new({
       vms_service: {},
       machine: OpenStruct.new({}),
     })
  }

  subject(:action) { described_class.new(app, env) }
 
  context 'is running' do
    before do
      allow(env.machine).to receive(:state).and_return({})
      allow(env.machine.state).to receive(:id).and_return(:up)
    end

    it 'calls is running' do
      action.call(env)
      expect(env.result).to eq(true)
    end
  end

  context 'is not running' do
    before do
      allow(env.machine).to receive(:state).and_return({})
      allow(env.machine.state).to receive(:id).and_return(:down)
    end

    it 'calls is running' do
      action.call(env)
      expect(env.result).to eq(false)
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-ovirt4-2.2.0 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-2.1.3 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-2.1.0 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-2.0.0 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.2.3 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.2.2 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.2.1 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.2.0 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.1.0 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.0.2 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.0.1 spec/vagrant-ovirt4/action/is_running_spec.rb
vagrant-ovirt4-1.0.0 spec/vagrant-ovirt4/action/is_running_spec.rb