|
| 1 | +Feature: |
| 2 | + In order to fill my .env file |
| 3 | + As a developer |
| 4 | + I want the companion to ask me the values of each missing variable, from a .env.dist file |
| 5 | + |
| 6 | + Scenario: It asks all the variables if the file is missing |
| 7 | + Given the file ".env.dist" contains: |
| 8 | + """ |
| 9 | + ## Something |
| 10 | + MY_VARIABLE=default-value |
| 11 | + """ |
| 12 | + When I run the companion with the following answers: |
| 13 | + | Let's fix this? (y) | y | |
| 14 | + | MY_VARIABLE ? (default-value) | my-value | |
| 15 | + And the file ".env" should contain: |
| 16 | + """ |
| 17 | + MY_VARIABLE=my-value |
| 18 | + """ |
| 19 | + |
| 20 | + Scenario: It asks only the missing variables |
| 21 | + Given the file ".env.dist" contains: |
| 22 | + """ |
| 23 | + ## Something |
| 24 | + MY_VARIABLE=default-value |
| 25 | + A_NEW_VARIABLE= |
| 26 | + """ |
| 27 | + And the file ".env" contains: |
| 28 | + """ |
| 29 | + MY_VARIABLE=something-else |
| 30 | +
|
| 31 | + """ |
| 32 | + When I run the companion with the following answers: |
| 33 | + | Let's fix this? (y) | y | |
| 34 | + | A_NEW_VARIABLE ? | value | |
| 35 | + And the file ".env" should contain: |
| 36 | + """ |
| 37 | + MY_VARIABLE=something-else |
| 38 | + A_NEW_VARIABLE=value |
| 39 | + """ |
| 40 | + |
| 41 | + Scenario: We ask an empty variable if it has a value |
| 42 | + Given the file ".env.dist" contains: |
| 43 | + """ |
| 44 | + ## Something |
| 45 | + MY_VARIABLE=default-value |
| 46 | + """ |
| 47 | + And the file ".env" contains: |
| 48 | + """ |
| 49 | + MY_VARIABLE= |
| 50 | + """ |
| 51 | + When I run the companion with the following answers: |
| 52 | + | Let's fix this? (y) | y | |
| 53 | + | MY_VARIABLE ? | | |
| 54 | + And the file ".env" should contain: |
| 55 | + """ |
| 56 | + MY_VARIABLE= |
| 57 | + """ |
| 58 | + |
| 59 | + Scenario: We do not ask an empty variable if the reference is empty |
| 60 | + Given the file ".env.dist" contains: |
| 61 | + """ |
| 62 | + ## Something |
| 63 | + EMPTY_VARIABLE= |
| 64 | + """ |
| 65 | + And the file ".env" contains: |
| 66 | + """ |
| 67 | + EMPTY_VARIABLE= |
| 68 | + """ |
| 69 | + When I run the companion with the following answers: |
| 70 | + | Let's fix this? (y) | y | |
| 71 | + And the file ".env" should contain: |
| 72 | + """ |
| 73 | + EMPTY_VARIABLE= |
| 74 | + """ |
| 75 | + |
| 76 | + Scenario: We do not ask for variable than have a falsy value |
| 77 | + Given the file ".env.dist" contains: |
| 78 | + """ |
| 79 | + ## Something |
| 80 | + MY_VARIABLE=default-value |
| 81 | + """ |
| 82 | + And the file ".env" contains: |
| 83 | + """ |
| 84 | + MY_VARIABLE=0 |
| 85 | + """ |
| 86 | + When I run the companion with the following answers: |
| 87 | + | Let's fix this? (y) | y | |
| 88 | + And the file ".env" should contain: |
| 89 | + """ |
| 90 | + MY_VARIABLE=0 |
| 91 | + """ |
0 commit comments