features/vagrant-exec.feature in vagrant-exec-0.3.0 vs features/vagrant-exec.feature in vagrant-exec-0.3.1
- old
+ new
@@ -10,11 +10,12 @@
Using Vagrantfile configuration
Background:
Given I write to "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
end
"""
@@ -50,11 +51,12 @@
And SHH subprocess should execute command "cd /vagrant && pwd"
Scenario: can use custom root
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.root = '/tmp'
end
@@ -65,11 +67,12 @@
And SHH subprocess should execute command "cd /tmp && pwd"
Scenario: raises error if root is improperly set
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.root = true
end
@@ -79,11 +82,12 @@
And the output should contain "root should be a string"
Scenario: can prepend all commands
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.prepend_with 'echo vagrant-exec &&'
end
@@ -94,11 +98,12 @@
And SHH subprocess should execute command "cd /vagrant && echo vagrant-exec && pwd"
Scenario: can prepend only specific commands
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.prepend_with 'echo vagrant-exec &&', :only => %w(pwd echo)
end
@@ -112,11 +117,12 @@
Then SHH subprocess should execute command "cd /vagrant && env"
Scenario: can use prepend multiple times
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.prepend_with 'echo vagrant-exec1 &&', :only => %w(pwd)
config.exec.prepend_with 'echo vagrant-exec2 &&', :only => %w(echo)
@@ -129,26 +135,27 @@
Then SHH subprocess should execute command "cd /vagrant && echo vagrant-exec2 && echo 1"
Scenario: raises error if prepend command is improperly set
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.prepend_with :test
end
"""
- Given I set vagrant-exec prepend with :test for all commands
- And I run `bundle exec vagrant up`
+ When I run `bundle exec vagrant up`
Then the exit status should not be 0
And the output should contain "prepend_with command should be a string"
Scenario: raises error if prepend only is improperly set
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.prepend_with 'echo vagrant-exec1 &&', :only => 'test'
end
@@ -158,10 +165,11 @@
And the output should contain "prepend_with :only should be an array"
Scenario: can export environment variables
Given I overwrite "Vagrantfile" with:
"""
- Vagrant.require_plugin 'vagrant-exec'
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
+ require 'vagrant-exec'
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.env['TEST1'] = true
config.exec.env['TEST2'] = false