Integtest: Add tests for building all books - #810
Conversation
Adds a basic test for building all books. I expect we'll want to refactor it significantly as we port more tests for Make to rspec, but this is a start!
| Some text. | ||
| ASCIIDOC | ||
| src.init_repo 'source' | ||
| src.write 'conf.yaml', <<~YAML |
There was a problem hiding this comment.
I think I'll end up having to make generating this file more parameterized and automatic but I'd like to wait for a follow up for that.
|
|
||
| ## | ||
| # Init a git repo in root and commit any files in it. | ||
| def init_repo(root) |
There was a problem hiding this comment.
I've moved this to the Source object because we'll want to initialize many repos when testing --all
| dest_file(file_name) | ||
| end | ||
| let(:contents) do | ||
| return unless File.exist? file |
There was a problem hiding this comment.
It looks strange to me to have a return in a let block. Maybe you can just write the line in a if File.exist? file
There was a problem hiding this comment.
It does feel weird? I'm not really sure the if File.exist? block is super clear either. I think for me coming from Java the return unless is more clear but I can't speak to idiomatic ruby.
There was a problem hiding this comment.
I guess I think of let blocks not quite as methods, more like procs. But this is not a critical thing and if you prefer using return, that's no problem.
There was a problem hiding this comment.
Thanks!
Let me see if I can resolve the merge conflicts here.....
|
Thanks for reviewing @estolfo! This is a big help! |
Adds a basic test for building all books. I expect we'll want to refactor
it significantly as we port more tests for Make to rspec, but this is a
start!