File: is_directory.feature

package info (click to toggle)
ruby-aruba 0.14.8-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,216 kB
  • sloc: ruby: 7,951; sh: 21; makefile: 12
file content (53 lines) | stat: -rw-r--r-- 1,362 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Feature: Check existence of directories

  Use the `#directory?` to check if a path is a directory 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(:directory) { 'dir.d' }

    before(:each) { create_directory(directory) }

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

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

  Scenario: Is directory and 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' }
      before(:each) { create_directory(directory) }

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

  Scenario: Is file, but should be directory and 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(:file) { 'file.txt' }
      before(:each) { touch(file) }

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