Sha256: c0179e2ae83b5217c9398fc9dd4940c77a20d833b08955db0b55df7bdb101261

Contents?: true

Size: 1.66 KB

Versions: 31

Compression:

Stored size: 1.66 KB

Contents

Feature: Check existence of files and directories

  Use the `#exist?` to check if a path exists within
  `aruba`'s working directory. , May also want to look for `#file?` or
  `#directory?` for some more specific tests.

  ```ruby
  require 'spec_helper'

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

  RSpec.describe 'Check if directory and file exist' do
    let(:directory) { 'dir.d' }
    let(:file) { 'file.txt' }

    before(:each) { create_directory(directory) }
    before(:each) { touch(file) }

    it { expect(exist?(directory)).to be true }
    it { expect(exist?(file)).to be true }
  end
  ```

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

  Scenario: Is file or directory and exists
    Given a file named "spec/create_directory_spec.rb" with:
    """ruby
    require 'spec_helper'

    RSpec.describe 'Check if directory and file exist', :type => :aruba do
      let(:directory) { 'dir.d' }
      let(:file) { 'file.txt' }

      before(:each) { create_directory(directory) }
      before(:each) { touch(file) }

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

  Scenario: Is file or directory and does not exist
    Given a file named "spec/create_directory_spec.rb" with:
    """ruby
    require 'spec_helper'

    RSpec.describe 'Check if directory and file exist', :type => :aruba do
      let(:directory) { 'dir.d' }
      let(:file) { 'file.txt' }

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

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
aruba-0.14.14 features/04_aruba_api/filesystem/check_existence_file_or_directory.feature
aruba-0.14.13 features/04_aruba_api/filesystem/check_existence_file_or_directory.feature
aruba-0.14.12 features/04_aruba_api/filesystem/check_existence_file_or_directory.feature
aruba-0.14.11 features/04_aruba_api/filesystem/check_existence_file_or_directory.feature
aruba-0.14.10 features/04_aruba_api/filesystem/check_existence_file_or_directory.feature
aruba-0.14.9 features/api/filesystem/does_exist.feature
aruba-0.14.8 features/api/filesystem/does_exist.feature
aruba-0.14.7 features/api/filesystem/does_exist.feature
aruba-0.14.6 features/api/filesystem/does_exist.feature
aruba-0.14.5 features/api/filesystem/does_exist.feature
aruba-0.14.4 features/api/filesystem/does_exist.feature
aruba-0.14.3 features/api/filesystem/does_exist.feature
aruba-win-fix-0.14.2 features/api/filesystem/does_exist.feature
aruba-0.14.2 features/api/filesystem/does_exist.feature
aruba-0.14.1 features/api/filesystem/does_exist.feature
aruba-0.14.0 features/api/filesystem/does_exist.feature
aruba-0.13.0 features/api/filesystem/does_exist.feature
aruba-0.12.0 features/api/filesystem/does_exist.feature
aruba-0.11.2 features/api/filesystem/does_exist.feature
aruba-0.11.1 features/api/filesystem/does_exist.feature