features/vagrant-exec/environment_variables.feature in vagrant-exec-0.4.0 vs features/vagrant-exec/environment_variables.feature in vagrant-exec-0.4.1
- old
+ new
@@ -6,13 +6,10 @@
I should be able to specify them in Vagrantfile
Scenario: can export environment variables for 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 '*', env: { 'TEST1' => true, 'TEST2' => false }
end
"""
@@ -22,13 +19,10 @@
And SHH subprocess should execute command "cd /vagrant && export TEST1=true && export TEST2=false && pwd"
Scenario: can export environment variables for 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', env: { 'TEST1' => 'yo' }
config.exec.commands %w(pwd echo), env: { 'TEST2' => true, 'TEST3' => false }
end
@@ -44,13 +38,10 @@
Then SHH subprocess should execute command "cd /vagrant && env"
Scenario: can combine environment variables
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 '*', env: { 'TEST1' => true }
config.exec.commands 'pwd', env: { 'TEST2' => false }
config.exec.commands %w(pwd echo), env: { 'TEST3' => false }
@@ -61,5 +52,17 @@
Then SHH subprocess should execute command "cd /vagrant && export TEST1=true && export TEST2=false && export TEST3=false && pwd"
When I run `bundle exec vagrant exec echo 1`
Then SHH subprocess should execute command "cd /vagrant && export TEST1=true && export TEST3=false && echo 1"
When I run `bundle exec vagrant exec env`
Then SHH subprocess should execute command "cd /vagrant && export TEST1=true && env"
+
+ Scenario: wraps values with spaces to quotes
+ Given I write to "Vagrantfile" with:
+ """
+ Vagrant.configure('2') do |config|
+ config.vm.box = 'vagrant_exec'
+ config.exec.commands 'pwd', env: { 'TEST' => 'one two' }
+ 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="one two" && pwd"