File: home_variable.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 (62 lines) | stat: -rw-r--r-- 1,922 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
54
55
56
57
58
59
60
61
62
Feature: Mock the HOME variable

  If you develop commandline applications, you might want to give your users
  the possibility to configure your program. Normally this is done via
  `.your-app-rc` or via `.config/your-app` an systems which comply to the
  freedesktop-specifications.

  To prevent to litter the developers HOME-directory `aruba` comes with a step
  which mocks the `HOME`-variable. It is set to the
  `aruba`-`working-directory`.

  Background:
    Given I use the fixture "cli-app"
    And an executable named "bin/cli" with:
    """
    #!/bin/bash

    echo "HOME: $HOME"
    """

  Scenario: Mocked home directory by using a step
    Given a file named "features/home_variable.feature" with:
    """
    Feature: Home Variable
      Scenario: Run command
        Given a mocked home directory
        When I run `cli`
        Then the output should match %r<HOME:.*tmp/aruba$>
    """
    When I run `cucumber`
    Then the features should all pass

  Scenario: Mocked home directory by using a tag
    Given a file named "features/home_variable.feature" with:
    """
    Feature: Home Variable
      @mocked-home-directory
      Scenario: Run command
        When I run `cli`
        Then the output should match %r<HOME:.*tmp/aruba$>
    """
    When I run `cucumber`
    Then the features should all pass

  Scenario: Redefine home directory by using the aruba configuration
    Given a file named "features/support/home_variable.rb" with:
    """
    require 'aruba/cucumber'

    Aruba.configure do |config|
      config.home_directory = File.join(config.root_directory, config.working_directory)
    end
    """
    Given a file named "features/home_variable.feature" with:
    """
    Feature: Home Variable
      Scenario: Run command
        When I run `cli`
        Then the output should match %r<HOME:.*tmp/aruba$>
    """
    When I run `cucumber`
    Then the features should all pass