Sha256: 550613ddad86f7ba6dff55233962877e57d349bdb93f1d8751914266a4e2b027

Contents?: true

Size: 1.82 KB

Versions: 1

Compression:

Stored size: 1.82 KB

Contents

@no-clobber
Feature: vagrant-exec directory
  In order to change the working directory
  For commands I execute using vagrant-exec
  As a user
  I should be able to specify it in Vagrantfile

  Scenario: uses /vagrant as default directory
    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'
      end
      """
    Given I run `bundle exec vagrant up`
    When I run `bundle exec vagrant exec pwd`
    Then the exit status should be 0
    And SHH subprocess should execute command "cd /vagrant && pwd"

  Scenario: can use custom directory 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 '*', directory: '/tmp'
      end
      """
    And I run `bundle exec vagrant up`
    When I run `bundle exec vagrant exec pwd`
    Then the exit status should be 0
    And SHH subprocess should execute command "cd /tmp && pwd"

  Scenario: can use custom directory 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 %w(pwd echo), directory: '/tmp'
      end
      """
    And I run `bundle exec vagrant up`
    When I run `bundle exec vagrant exec echo 1`
    Then SHH subprocess should execute command "cd /tmp && echo 1"
    When I run `bundle exec vagrant exec env`
    Then SHH subprocess should execute command "cd /vagrant && env"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-exec-0.4.0 features/vagrant-exec/directory.feature