features/vagrant-exec/prepend.feature in vagrant-exec-0.4.0 vs features/vagrant-exec/prepend.feature in vagrant-exec-0.4.1
- old
+ new
@@ -6,13 +6,10 @@
I should be able to specify it in Vagrantfile
Scenario: can prepend all commands
Given I write to "Vagrantfile" with:
"""
- $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
- require 'vagrant-exec'
-
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.commands '*', prepend: 'echo vagrant-exec &&'
end
"""
@@ -22,13 +19,10 @@
And SHH subprocess should execute command "cd /vagrant && echo vagrant-exec && pwd"
Scenario: can prepend specific commands
Given I write to "Vagrantfile" with:
"""
- $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
- require 'vagrant-exec'
-
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.commands 'cmd', prepend: 'echo vagrant-exec1 &&'
config.exec.commands %w(pwd echo), prepend: 'echo vagrant-exec2 &&'
end
@@ -44,13 +38,10 @@
Then SHH subprocess should execute command "cd /vagrant && env"
Scenario: can combine prepended
Given I write to "Vagrantfile" with:
"""
- $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
- require 'vagrant-exec'
-
Vagrant.configure('2') do |config|
config.vm.box = 'vagrant_exec'
config.exec.commands '*', prepend: 'echo vagrant-exec1 &&'
config.exec.commands 'pwd', prepend: 'echo vagrant-exec2 &&'
config.exec.commands %w(pwd echo), prepend: 'echo vagrant-exec3 &&'
@@ -62,5 +53,17 @@
When I run `bundle exec vagrant exec echo 1`
Then SHH subprocess should execute command "cd /vagrant && echo vagrant-exec1 && echo vagrant-exec3 && echo 1"
When I run `bundle exec vagrant exec env`
Then SHH subprocess should execute command "cd /vagrant && echo vagrant-exec1 && env"
+ Scenario: adds prepend only in the end
+ Given I write to "Vagrantfile" with:
+ """
+ Vagrant.configure('2') do |config|
+ config.vm.box = 'vagrant_exec'
+ config.exec.commands 'pwd', prepend: 'bundle exec'
+ config.exec.commands 'pwd', env: { 'TEST' => true }
+ end
+ """
+ And I run `bundle exec vagrant up`
+ When I run `bundle exec vagrant exec pwd`
+ Then SHH subprocess should execute command "cd /vagrant && export TEST=true && bundle exec pwd"