I have a feature that will open the user's editor (specified in $EDITOR
) with an empty temporary file somewhere in /tmp
. The user than has to save this file, and if it has changed content, another command should be run with that temporary file.
When I run `app new`
And I the user enters and saves text
Then "another-app --process <tmpfile>" should be run
I already have steps to check a command is run, which leaves me with two problems:
Note: I have setup a fakebin solution, so I could set $EDITOR
to a script that would just output some text to the specified file. This might be a solution for (1), but that still leaves me with (2).
1 is easy since it is just a command changing a file. Whether it is the editor or sed
or something else doesn't matter. You could unit test the object calling the command to make sure it runs $EDITOR path/to/file
but that's not something your acceptance test should care about. 2 is easy too, since Cucucmber doesn't have to know the command that got run. That's a unit test thing. Cucumber should only observe the outside effect (some file was created, some output is shown on the screen, etc).
Let Cucumber observe what happens as seen by the user. Let your unit tests check how that happens.