github.com/tooploox/oya@v0.0.21-0.20230524103240-1cda1861aad6/features/oyas.feature (about)

     1  Feature: Support for .oya files
     2  
     3  Background:
     4     Given I'm in project dir
     5  
     6  Scenario: It loads values from *.oya
     7    Given file ./Oyafile containing
     8      """
     9      Project: Secrets
    10      Values:
    11        foo: apple
    12  
    13      showValues: |
    14        echo ${Oya[foo]}
    15        echo ${Oya[bar]}
    16        echo ${Oya[baz]}
    17      """
    18    And file ./values1.oya containing
    19      """
    20      bar: banana
    21      """
    22    And file ./values2.oya containing
    23      """
    24      baz: orange
    25      """
    26    When I run "oya run showValues"
    27    Then the command succeeds
    28    And the command outputs
    29    """
    30    apple
    31    banana
    32    orange
    33  
    34    """
    35  
    36  Scenario: It correctly merges values, processing *.oya alphabetically
    37    Given file ./Oyafile containing
    38      """
    39      Project: Secrets
    40      Values:
    41        foo:
    42          bar: xxx
    43          baz: apple
    44  
    45      showValues: |
    46        echo ${Oya[foo.bar]}
    47        echo ${Oya[foo.baz]}
    48        echo ${Oya[foo.qux]}
    49      """
    50    And file ./0_values.oya containing
    51      """
    52      foo:
    53        bar: banana
    54        qux: peach
    55      """
    56    And file ./1_values.oya containing
    57      """
    58      foo:
    59        qux: coconut
    60      """
    61    When I run "oya run showValues"
    62    Then the command succeeds
    63    And the command outputs
    64    """
    65    banana
    66    apple
    67    coconut
    68  
    69    """
    70  
    71  Scenario: Support for .oya in a pack
    72    Given file ./Oyafile containing
    73      """
    74      Project: project
    75  
    76      Require:
    77        github.com/test/foo: v0.0.1
    78  
    79      Import:
    80        foo: github.com/test/foo
    81      """
    82    And file ./.oya/packs/github.com/test/foo@v0.0.1/Oyafile containing
    83      """
    84      # Project: foo
    85  
    86      echo: |
    87        echo ${Oya[fruit]}
    88  
    89      """
    90    And file ./.oya/packs/github.com/test/foo@v0.0.1/values.oya containing
    91      """
    92      fruit: orange
    93      """
    94    When I run "oya run foo.echo"
    95    Then the command succeeds
    96    And the command outputs
    97    """
    98    orange
    99  
   100    """