Sha256: dba3b916f3f38fe985434e1bcfcd7acba95d2fa420657202c3b2de9de0652bdf

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

# This is a shared example that tests that a command requires a
# Vagrant environment to run properly. The exact command to run
# should be given as a parameter to the shared examples.
shared_examples "a command that requires a Vagrantfile" do |*args|
  let(:command) do
    raise ArgumentError, "A command must be set for the shared example." if args.empty?
    args[0]
  end

  it "fails if no Vagrantfile is found" do
    result = execute(*command)
    result.should_not be_success
    result.stdout.should match_output(:no_vagrantfile)
  end
end

# This is a shared example that tests that the command requires a
# virtual machine to be created, and additionally to be in one of
# many states.
shared_examples "a command that requires a virtual machine" do |*args|
  let(:command) do
    raise ArgumentError, "A command must be set for the shared example." if args.empty?
    args[0]
  end

  it "fails if the virtual machine is not created" do
    assert_execute("vagrant", "init")

    result = execute(*command)
    result.should_not be_success
    result.stdout.should match_output(:error_vm_must_be_created)
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
vagrantup-0.8.9 test/acceptance/support/shared/command_examples.rb
vagrantup-0.8.8 test/acceptance/support/shared/command_examples.rb
vagrantup-0.8.10 test/acceptance/support/shared/command_examples.rb
vagrant-0.8.10 test/acceptance/support/shared/command_examples.rb
vagrant-0.8.8 test/acceptance/support/shared/command_examples.rb