Sha256: e034196eecbcdf99caef0e1b9102daab0fc5b391f733a7efb08e552ef11ba75f

Contents?: true

Size: 1.24 KB

Versions: 13

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

require 'fileutils'
require 'aruba/matchers/path'

RSpec.describe 'Path Matchers' do
  include_context 'uses aruba API'

  def expand_path(*args)
    @aruba.expand_path(*args)
  end

  describe 'to_be_an_absolute_path' do
    let(:name) { @file_name }
    let(:path) { @aruba.expand_path(name) }

    context 'when is absolute path' do
      it { expect(path).to be_an_absolute_path }
    end

    context 'when is relative path' do
      it { expect(name).not_to be_an_absolute_path }
    end
  end

  describe 'to_be_an_existing_path' do
    context 'when file' do
      context 'exists' do
        before :each do
          Aruba.platform.write_file(@file_path, '')
        end

        it { expect(@file_name).to be_an_existing_path }
      end

      context 'does not exist' do
        it { expect(@file_name).not_to be_an_existing_path }
      end
    end

    context 'when directory' do
      let(:name) { 'test.d' }
      let(:path) { @aruba.expand_path(name) }

      context 'exists' do
        before :each do
          FileUtils.mkdir_p path
        end

        it { expect(name).to be_an_existing_path }
      end

      context 'does not exist' do
        it { expect(name).not_to be_an_existing_path }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
aruba-0.14.14 spec/aruba/matchers/path_spec.rb
aruba-0.14.13 spec/aruba/matchers/path_spec.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/aruba-0.14.12/spec/aruba/matchers/path_spec.rb
aruba-0.14.12 spec/aruba/matchers/path_spec.rb
aruba-0.14.11 spec/aruba/matchers/path_spec.rb
aruba-0.14.10 spec/aruba/matchers/path_spec.rb
aruba-0.14.9 spec/aruba/matchers/path_spec.rb
aruba-0.14.8 spec/aruba/matchers/path_spec.rb
aruba-0.14.7 spec/aruba/matchers/path_spec.rb
aruba-0.14.6 spec/aruba/matchers/path_spec.rb
aruba-0.14.5 spec/aruba/matchers/path_spec.rb
aruba-0.14.4 spec/aruba/matchers/path_spec.rb
aruba-0.14.3 spec/aruba/matchers/path_spec.rb