Sha256: 7e8d8c8f4aa0690d4752ea58d4bfe8ca09dd5775f8e1d79848c6c87fe8d9c26e

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

Feature: Check if path is relative

  Use the `#relative?`-method to check if a path is an relative path.

  ```ruby
  require 'spec_helper'

  RSpec.configure do |config|
    config.include Aruba::Api
  end

  RSpec.describe 'Check if directory or file is relative' do
    let(:path) { '/path/to/file.txt' }

    it { expect(relative?(path)).to be true }
  end
  ```

  Background:
    Given I use a fixture named "cli-app"

  Scenario: Is path relative
    Given a file named "spec/create_directory_spec.rb" with:
    """
    require 'spec_helper'

    RSpec.describe 'Check if directory or file is relative', :type => :aruba do
      let(:path) { 'file.txt' }

      it { expect(relative?(path)).to be true }
    end
    """
    When I run `rspec`
    Then the specs should all pass

  Scenario: Path should be relative, but it's relative
    Given a file named "spec/create_directory_spec.rb" with:
    """
    require 'spec_helper'

    RSpec.describe 'Check if directory or file is relative', :type => :aruba do
      let(:path) { '/path/to/file.txt' }

      it { expect(relative?(path)).to be false }
    end
    """
    When I run `rspec`
    Then the specs should all pass

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aruba-0.9.0.pre features/api/filesystem/is_relative.feature