aruba 0.14.3 → 0.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/History.md +6 -0
- data/features/getting_started/cleanup.feature +27 -36
- data/lib/aruba/api/core.rb +4 -3
- data/lib/aruba/api/deprecated.rb +1 -1
- data/lib/aruba/cucumber/hooks.rb +4 -0
- data/lib/aruba/platforms/unix_command_string.rb +1 -1
- data/lib/aruba/platforms/windows_command_string.rb +7 -6
- data/lib/aruba/setup.rb +6 -4
- data/lib/aruba/version.rb +1 -1
- data/spec/aruba/api_spec.rb +4 -0
- data/spec/aruba/platforms/unix_command_string_spec.rb +17 -0
- data/spec/aruba/platforms/windows_command_string_spec.rb +22 -0
- data/spec/aruba/spawn_process_spec.rb +36 -0
- metadata +6 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: d4cc495b4f8d40275335450c938adca9d0bd7a47b2c2f8e38c639620c822fd1b
         | 
| 4 | 
            +
              data.tar.gz: f27059712ef37f5eeac18139ac8634f495c65d8d4f0ee626aeb539796e5d2998
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0fdcce2f62d27eebaf4a294f4725abfe75212a26a30a62024d532a302446bcde074cb3ad8f4767b5fb8d20f851d77c01dde22e29ad333605eab70ad6f5cd8cec
         | 
| 7 | 
            +
              data.tar.gz: f8a4721f5075b6769c8100896b0f92d06095959e40683d1d2006a9bcd9627613b04e7c5b6156e62b9064463f54df0a89941253ee63eaf845b18718cc6876465f
         | 
    
        data/History.md
    CHANGED
    
    | @@ -1,5 +1,11 @@ | |
| 1 1 | 
             
            #  RELEASED
         | 
| 2 2 |  | 
| 3 | 
            +
            ## [v0.14.4](https://github.com/cucumber/aruba/compare/v0.14.3...v0.14.4)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * Fix command spawning when run in directories with spaces (#490)
         | 
| 6 | 
            +
            * Ensure setup is still done when using `@no-clobber` (#529)
         | 
| 7 | 
            +
            * Make `#expand_path` handle absolute paths correctly (#486)
         | 
| 8 | 
            +
             | 
| 3 9 | 
             
            ## [v0.14.3](https://github.com/cucumber/aruba/compare/v0.14.2...v0.14.3)
         | 
| 4 10 |  | 
| 5 11 | 
             
            * Fix path bug (#422)
         | 
| @@ -9,57 +9,48 @@ Feature: Cleanup Aruba Working Directory | |
| 9 9 | 
             
              Background:
         | 
| 10 10 | 
             
                Given I use a fixture named "cli-app"
         | 
| 11 11 |  | 
| 12 | 
            -
              Scenario:  | 
| 13 | 
            -
                Given a file named " | 
| 14 | 
            -
                And a directory named "tmp/aruba/dir.d"
         | 
| 15 | 
            -
                And a file named "features/flushing.feature" with:
         | 
| 12 | 
            +
              Scenario: Clean up artifacts and pwd from a previous scenario
         | 
| 13 | 
            +
                Given a file named "features/cleanup.feature" with:
         | 
| 16 14 | 
             
                """
         | 
| 17 15 | 
             
                Feature: Check
         | 
| 18 | 
            -
                  Scenario: Check
         | 
| 19 | 
            -
                     | 
| 20 | 
            -
                    And a directory named "dir.d" | 
| 16 | 
            +
                  Scenario: Check #1
         | 
| 17 | 
            +
                    Given a file named "file.txt" with "content"
         | 
| 18 | 
            +
                    And a directory named "dir.d"
         | 
| 19 | 
            +
                    Then a file named "file.txt" should exist
         | 
| 20 | 
            +
                    And a directory named "dir.d" should exist
         | 
| 21 | 
            +
                    When I cd to "dir.d"
         | 
| 22 | 
            +
                    And I run `pwd`
         | 
| 23 | 
            +
                    Then the output should match %r</tmp/aruba/dir.d$>
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  Scenario: Check #2
         | 
| 26 | 
            +
                    Then a file named "file.txt" should not exist
         | 
| 27 | 
            +
                    And a directory named "dir.d" should not exist
         | 
| 28 | 
            +
                    When I run `pwd`
         | 
| 29 | 
            +
                    Then the output should match %r</tmp/aruba$>
         | 
| 21 30 | 
             
                """
         | 
| 22 31 | 
             
                When I run `cucumber`
         | 
| 23 32 | 
             
                Then the features should all pass
         | 
| 24 33 |  | 
| 25 34 | 
             
              Scenario: Do not clobber before run
         | 
| 35 | 
            +
                The `@no-clobber` tag stops Aruba from clearing out its scratch directory.
         | 
| 36 | 
            +
                Other setup steps are still performed, such as setting the current working
         | 
| 37 | 
            +
                directory.
         | 
| 38 | 
            +
             | 
| 26 39 | 
             
                Given a file named "tmp/aruba/file.txt" with "content"
         | 
| 27 40 | 
             
                And a directory named "tmp/aruba/dir.d"
         | 
| 28 | 
            -
                And a file named "features/ | 
| 41 | 
            +
                And a file named "features/cleanup.feature" with:
         | 
| 29 42 | 
             
                """
         | 
| 30 43 | 
             
                Feature: Check
         | 
| 31 | 
            -
                   | 
| 32 | 
            -
             | 
| 44 | 
            +
                  Scenario: Check #1
         | 
| 45 | 
            +
                    Given a file named "file.txt" with "content"
         | 
| 46 | 
            +
                    And a directory named "dir.d"
         | 
| 33 47 | 
             
                    Then a file named "file.txt" should exist
         | 
| 34 48 | 
             
                    And a directory named "dir.d" should exist
         | 
| 35 | 
            -
                """
         | 
| 36 | 
            -
                When I run `cucumber`
         | 
| 37 | 
            -
                Then the features should all pass
         | 
| 38 | 
            -
             | 
| 39 | 
            -
              Scenario: Cleanup and verify the previous scenario
         | 
| 40 | 
            -
                Given a file named "features/flushing.feature" with:
         | 
| 41 | 
            -
                """
         | 
| 42 | 
            -
                Feature: Check
         | 
| 43 | 
            -
                  Scenario: Check #1
         | 
| 44 | 
            -
                    Given a file named "tmp/aruba/file.txt" with "content"
         | 
| 45 | 
            -
                    And a directory named "tmp/aruba/dir.d"
         | 
| 46 49 |  | 
| 50 | 
            +
                  @no-clobber
         | 
| 47 51 | 
             
                  Scenario: Check #2
         | 
| 48 | 
            -
                    Then a file named "file.txt" should  | 
| 49 | 
            -
                    And a directory named "dir.d" should  | 
| 50 | 
            -
                """
         | 
| 51 | 
            -
                When I run `cucumber`
         | 
| 52 | 
            -
                Then the features should all pass
         | 
| 53 | 
            -
             | 
| 54 | 
            -
              Scenario:  Current directory from previous scenario is reseted
         | 
| 55 | 
            -
                Given a file named "features/non-existence.feature" with:
         | 
| 56 | 
            -
                """
         | 
| 57 | 
            -
                Feature: Reset
         | 
| 58 | 
            -
                  Scenario: Reset #1
         | 
| 59 | 
            -
                    Given a directory named "dir1"
         | 
| 60 | 
            -
                    When I cd to "dir1"
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                  Scenario: Reset #2
         | 
| 52 | 
            +
                    Then a file named "file.txt" should exist
         | 
| 53 | 
            +
                    And a directory named "dir.d" should exist
         | 
| 63 54 | 
             
                    When I run `pwd`
         | 
| 64 55 | 
             
                    Then the output should match %r</tmp/aruba$>
         | 
| 65 56 | 
             
                """
         | 
    
        data/lib/aruba/api/core.rb
    CHANGED
    
    | @@ -25,8 +25,8 @@ module Aruba | |
| 25 25 | 
             
                  # This will only clean up aruba's working directory to remove all
         | 
| 26 26 | 
             
                  # artifacts of your tests. This does NOT clean up the current working
         | 
| 27 27 | 
             
                  # directory.
         | 
| 28 | 
            -
                  def setup_aruba
         | 
| 29 | 
            -
                    Aruba::Setup.new(aruba).call
         | 
| 28 | 
            +
                  def setup_aruba(clobber = true)
         | 
| 29 | 
            +
                    Aruba::Setup.new(aruba).call(clobber)
         | 
| 30 30 |  | 
| 31 31 | 
             
                    self
         | 
| 32 32 | 
             
                  end
         | 
| @@ -163,7 +163,8 @@ module Aruba | |
| 163 163 | 
             
                      path.to_s
         | 
| 164 164 | 
             
                    else
         | 
| 165 165 | 
             
                      directory = File.join(aruba.root_directory, aruba.current_directory)
         | 
| 166 | 
            -
                       | 
| 166 | 
            +
                      directory = File.expand_path(dir_string, directory) if dir_string
         | 
| 167 | 
            +
                      File.expand_path(file_name, directory)
         | 
| 167 168 | 
             
                    end
         | 
| 168 169 | 
             
                  end
         | 
| 169 170 | 
             
                  # rubocop:enable Metrics/MethodLength
         | 
    
        data/lib/aruba/api/deprecated.rb
    CHANGED
    
    | @@ -294,7 +294,7 @@ module Aruba | |
| 294 294 |  | 
| 295 295 | 
             
                  # @deprecated
         | 
| 296 296 | 
             
                  def assert_exit_status_and_partial_output(expect_to_pass, expected)
         | 
| 297 | 
            -
                    Aruba.platform.deprecated('The use of "assert_exit_status_and_partial_output" is deprecated. Use "# | 
| 297 | 
            +
                    Aruba.platform.deprecated('The use of "assert_exit_status_and_partial_output" is deprecated. Use "#assert_success" and "#assert_partial_output" instead')
         | 
| 298 298 |  | 
| 299 299 | 
             
                    assert_success(expect_to_pass)
         | 
| 300 300 | 
             
                    assert_partial_output(expected, all_output)
         | 
    
        data/lib/aruba/cucumber/hooks.rb
    CHANGED
    
    
| @@ -10,14 +10,9 @@ module Aruba | |
| 10 10 | 
             
                #
         | 
| 11 11 | 
             
                # @private
         | 
| 12 12 | 
             
                class WindowsCommandString < SimpleDelegator
         | 
| 13 | 
            -
                  def initialize(cmd)
         | 
| 14 | 
            -
                    __setobj__ format('%s /c "%s"', Aruba.platform.which('cmd.exe'), cmd)
         | 
| 15 | 
            -
                  end
         | 
| 16 | 
            -
             | 
| 17 13 | 
             
                  # Convert to array
         | 
| 18 14 | 
             
                  def to_a
         | 
| 19 | 
            -
                     | 
| 20 | 
            -
                      map { |w| w.gsub('ARUBA_TMP_PATHSEPARATOR', '\\') }
         | 
| 15 | 
            +
                    [cmd_path, '/c', __getobj__]
         | 
| 21 16 | 
             
                  end
         | 
| 22 17 |  | 
| 23 18 | 
             
                  if RUBY_VERSION < '1.9'
         | 
| @@ -26,6 +21,12 @@ module Aruba | |
| 26 21 | 
             
                    end
         | 
| 27 22 | 
             
                    alias inspect to_s
         | 
| 28 23 | 
             
                  end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  private
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  def cmd_path
         | 
| 28 | 
            +
                    Aruba.platform.which('cmd.exe')
         | 
| 29 | 
            +
                  end
         | 
| 29 30 | 
             
                end
         | 
| 30 31 | 
             
              end
         | 
| 31 32 | 
             
            end
         | 
    
        data/lib/aruba/setup.rb
    CHANGED
    
    | @@ -10,10 +10,10 @@ module Aruba | |
| 10 10 | 
             
                  @runtime = runtime
         | 
| 11 11 | 
             
                end
         | 
| 12 12 |  | 
| 13 | 
            -
                def call
         | 
| 13 | 
            +
                def call(clobber = true)
         | 
| 14 14 | 
             
                  return if runtime.setup_already_done?
         | 
| 15 15 |  | 
| 16 | 
            -
                  working_directory
         | 
| 16 | 
            +
                  working_directory(clobber)
         | 
| 17 17 | 
             
                  events
         | 
| 18 18 |  | 
| 19 19 | 
             
                  runtime.setup_done
         | 
| @@ -23,8 +23,10 @@ module Aruba | |
| 23 23 |  | 
| 24 24 | 
             
                private
         | 
| 25 25 |  | 
| 26 | 
            -
                def working_directory
         | 
| 27 | 
            -
                   | 
| 26 | 
            +
                def working_directory(clobber = true)
         | 
| 27 | 
            +
                  if clobber
         | 
| 28 | 
            +
                    Aruba.platform.rm File.join(runtime.config.root_directory, runtime.config.working_directory), :force => true
         | 
| 29 | 
            +
                  end
         | 
| 28 30 | 
             
                  Aruba.platform.mkdir File.join(runtime.config.root_directory, runtime.config.working_directory)
         | 
| 29 31 | 
             
                  Aruba.platform.chdir runtime.config.root_directory
         | 
| 30 32 | 
             
                end
         | 
    
        data/lib/aruba/version.rb
    CHANGED
    
    
    
        data/spec/aruba/api_spec.rb
    CHANGED
    
    | @@ -654,6 +654,10 @@ describe Aruba::Api do | |
| 654 654 | 
             
                    it { expect(@aruba.expand_path(@file_name)).to eq File.expand_path(@file_path) }
         | 
| 655 655 | 
             
                  end
         | 
| 656 656 |  | 
| 657 | 
            +
                  context 'when file_path is given' do
         | 
| 658 | 
            +
                    it { expect(@aruba.expand_path(@file_path)).to eq @file_path }
         | 
| 659 | 
            +
                  end
         | 
| 660 | 
            +
             | 
| 657 661 | 
             
                  context 'when path contains "."' do
         | 
| 658 662 | 
             
                    it { expect(@aruba.expand_path('.')).to eq File.expand_path(aruba.current_directory) }
         | 
| 659 663 | 
             
                  end
         | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            RSpec.describe Aruba::Platforms::UnixCommandString do
         | 
| 4 | 
            +
              let(:command_string) { described_class.new(base_command) }
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              describe '#to_a' do
         | 
| 7 | 
            +
                context 'with a command with a path' do
         | 
| 8 | 
            +
                  let(:base_command) { '/foo/bar' }
         | 
| 9 | 
            +
                  it { expect(command_string.to_a).to eq [base_command] }
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                context 'with a command with a path containing spaces' do
         | 
| 13 | 
            +
                  let(:base_command) { '/foo bar/baz' }
         | 
| 14 | 
            +
                  it { expect(command_string.to_a).to eq [base_command] }
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            RSpec.describe Aruba::Platforms::WindowsCommandString do
         | 
| 4 | 
            +
              let(:command_string) { described_class.new(base_command) }
         | 
| 5 | 
            +
              let(:cmd_path) { 'C:\Some Path\cmd.exe' }
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              before do
         | 
| 8 | 
            +
                allow(Aruba.platform).to receive(:which).with('cmd.exe').and_return(cmd_path)
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              describe '#to_a' do
         | 
| 12 | 
            +
                context 'with a command with a path' do
         | 
| 13 | 
            +
                  let(:base_command) { 'C:\Foo\Bar' }
         | 
| 14 | 
            +
                  it { expect(command_string.to_a).to eq [cmd_path, '/c', base_command] }
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                context 'with a command with a path containing spaces' do
         | 
| 18 | 
            +
                  let(:base_command) { 'C:\Foo Bar\Baz' }
         | 
| 19 | 
            +
                  it { expect(command_string.to_a).to eq [cmd_path, '/c', base_command] }
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         | 
| @@ -56,5 +56,41 @@ RSpec.describe Aruba::Processes::SpawnProcess do | |
| 56 56 |  | 
| 57 57 | 
             
                  it { expect {process.start}.to raise_error Aruba::LaunchError }
         | 
| 58 58 | 
             
                end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                context 'with a command with a space in the path on unix' do
         | 
| 61 | 
            +
                  let(:child) { instance_double(ChildProcess::AbstractProcess).as_null_object }
         | 
| 62 | 
            +
                  let(:io) { instance_double(ChildProcess::AbstractIO).as_null_object }
         | 
| 63 | 
            +
                  let(:command) { 'foo' }
         | 
| 64 | 
            +
                  let(:command_path) { '/path with space/foo' }
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  before do
         | 
| 67 | 
            +
                    allow(Aruba.platform).to receive(:command_string).and_return Aruba::Platforms::UnixCommandString
         | 
| 68 | 
            +
                    allow(Aruba.platform).to receive(:which).with(command, anything).and_return(command_path)
         | 
| 69 | 
            +
                    allow(ChildProcess).to receive(:build).with(command_path).and_return(child)
         | 
| 70 | 
            +
                    allow(child).to receive(:io).and_return io
         | 
| 71 | 
            +
                    allow(child).to receive(:environment).and_return({})
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  it { expect { process.start }.to_not raise_error }
         | 
| 75 | 
            +
                end
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                context 'with a command with a space in the path on windows' do
         | 
| 78 | 
            +
                  let(:child) { instance_double(ChildProcess::AbstractProcess).as_null_object }
         | 
| 79 | 
            +
                  let(:io) { instance_double(ChildProcess::AbstractIO).as_null_object }
         | 
| 80 | 
            +
                  let(:command) { 'foo' }
         | 
| 81 | 
            +
                  let(:cmd_path) { 'C:\Some Path\cmd.exe' }
         | 
| 82 | 
            +
                  let(:command_path) { 'D:\Bar Baz\foo' }
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                  before do
         | 
| 85 | 
            +
                    allow(Aruba.platform).to receive(:command_string).and_return Aruba::Platforms::WindowsCommandString
         | 
| 86 | 
            +
                    allow(Aruba.platform).to receive(:which).with('cmd.exe').and_return(cmd_path)
         | 
| 87 | 
            +
                    allow(Aruba.platform).to receive(:which).with(command, anything).and_return(command_path)
         | 
| 88 | 
            +
                    allow(ChildProcess).to receive(:build).with(cmd_path, '/c', command_path).and_return(child)
         | 
| 89 | 
            +
                    allow(child).to receive(:io).and_return io
         | 
| 90 | 
            +
                    allow(child).to receive(:environment).and_return({})
         | 
| 91 | 
            +
                  end
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                  it { expect { process.start }.to_not raise_error }
         | 
| 94 | 
            +
                end
         | 
| 59 95 | 
             
              end
         | 
| 60 96 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: aruba
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.14. | 
| 4 | 
            +
              version: 0.14.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Aslak Hellesøy
         | 
| @@ -13,7 +13,7 @@ authors: | |
| 13 13 | 
             
            autorequire: 
         | 
| 14 14 | 
             
            bindir: bin
         | 
| 15 15 | 
             
            cert_chain: []
         | 
| 16 | 
            -
            date:  | 
| 16 | 
            +
            date: 2018-03-06 00:00:00.000000000 Z
         | 
| 17 17 | 
             
            dependencies:
         | 
| 18 18 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 19 19 | 
             
              name: cucumber
         | 
| @@ -412,6 +412,8 @@ files: | |
| 412 412 | 
             
            - spec/aruba/matchers/path_spec.rb
         | 
| 413 413 | 
             
            - spec/aruba/platform/simple_table_spec.rb
         | 
| 414 414 | 
             
            - spec/aruba/platform/windows_environment_variables_spec.rb
         | 
| 415 | 
            +
            - spec/aruba/platforms/unix_command_string_spec.rb
         | 
| 416 | 
            +
            - spec/aruba/platforms/windows_command_string_spec.rb
         | 
| 415 417 | 
             
            - spec/aruba/rspec_spec.rb
         | 
| 416 418 | 
             
            - spec/aruba/runtime_spec.rb
         | 
| 417 419 | 
             
            - spec/aruba/spawn_process_spec.rb
         | 
| @@ -473,8 +475,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 473 475 | 
             
                  version: '0'
         | 
| 474 476 | 
             
            requirements: []
         | 
| 475 477 | 
             
            rubyforge_project: 
         | 
| 476 | 
            -
            rubygems_version: 2.6 | 
| 478 | 
            +
            rubygems_version: 2.7.6
         | 
| 477 479 | 
             
            signing_key: 
         | 
| 478 480 | 
             
            specification_version: 4
         | 
| 479 | 
            -
            summary: aruba-0.14. | 
| 481 | 
            +
            summary: aruba-0.14.4
         | 
| 480 482 | 
             
            test_files: []
         |