Sha256: 83ddca7c88653d5989a3ddffc6ddfd685da7b08dc36b4ad6e8fdabb0b752ca79

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

Feature: Check existence of files

  Use the `#file?` to check if a path is a file and exists within `aruba`'s
  working directory.

  ```ruby
  require 'spec_helper'

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

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

    before(:each) { touch(file) }

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

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

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

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

      before(:each) { touch(file) }

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

  Scenario: Is directory, but should be file and exist
    Given a file named "spec/create_directory_spec.rb" with:
    """
    require 'spec_helper'

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

      it { expect(file?(directory)).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_file.feature