Make it possible to override the file name "rerun.txt"#21
Make it possible to override the file name "rerun.txt"#21dbrock wants to merge 6 commits intoguard:masterfrom
Conversation
|
It's a bit tricky to pass options to a formatter (guard-rspec has the same issues). Still I'd prefer the following:
# initalization
@env = Nenv(:guard_cucumber) { |n| n.create_method(:rerun_file) { |name| name || "rerun.txt" } }
# usage
File.open(@env.rerun_file, "w") # etc |
Especially when running in a read-only filesystem, one needs to be able to configure the file name used for the `rerun.txt` file.
|
Done:
Not sure why we would need to set it, but I changed it to read it anyway.
Added tests for both reading and writing the file. Could probably refactor the read-side tests to use this new mechanism as the main path and then a simpler test to verify that it defaults to Not done:
I actually figured this was less important than testing the main path.
Didn't look into this, but I agree that it would probably be nice.
Didn't have time to look into this, but thanks for the pointer. Sorry about including the Cucumber 2.0 fix in this pull request, hope that's OK. |
|
Don't worry about Cucumber 2.0, since that has to be released first anyway. I think there's no reason for people not to switch to cucumber 2.0 (since it's supposed to be possibly 100% compatible) - so this comes later. A few notes about improving the code you based the changes on:
errors_file = Pathname(rerun_file)
begin
errors_file.read.split(" ")
errors_file.unlink
rescue Errno::ENOENT
endThis should make tests easier, because you're only stubbing 1 method instead of 3.
guard :cucumber, rerun_file: 'my_rerun.txt' do
# (...)
endThen, in This way, you can make the notifier always expect the environment variable (it should even be so that it fails without it - less code, less tests). Let me know if you have questions. |
|
You can rebase to master branch (for Cucumber 2.x). |
Especially when running in a read-only filesystem, one needs to be able to configure the file name used for the
rerun.txtfile.