Feature: Generating output examples for a custom HTML backend
Background:
Given I do have a template-based HTML backend with DocTest
Scenario: Generate missing output examples
When I run `bundle exec rake doctest:generate`
Then the output should contain:
"""
Generating test examples *:* in examples/html
--> Skipping document:title-with-author
--> Generating inline_quoted:emphasis
--> Unchanged quote:with-id-and-role
--> Generating quote:with-title
--> Skipping quote:with-attribution
--> Unknown quote:basic, doesn't exist in input examples!
"""
And the file "examples/html/quote.html" should contain exactly:
"""
Four score and seven years ago our fathers brought forth
on this continent a new nation…
Everybody remember
where we parked.
A person who never made a mistake never tried anything new.
Albert Einstein
After landing the cloaked Klingon bird of prey in Golden Gate park:
Everybody remember where we parked.
"""
And the file "examples/html/document.html" should contain exactly:
"""
"""
And the file "examples/html/inline_quoted.html" should contain exactly:
"""
chunky bacon
"""
Scenario: Regenerate all outdated output examples
When I run `bundle exec rake doctest:generate FORCE=yes`
Then the output should contain:
"""
Generating test examples *:* in examples/html
--> Rewriting document:title-with-author
--> Generating inline_quoted:emphasis
--> Unchanged quote:with-id-and-role
--> Generating quote:with-title
--> Rewriting quote:with-attribution
--> Unknown quote:basic, doesn't exist in input examples!
"""
And the file "examples/html/quote.html" should contain exactly:
"""
Four score and seven years ago our fathers brought forth
on this continent a new nation…
Everybody remember
where we parked.
A person who never made a mistake never tried anything new.
— Albert Einstein
After landing the cloaked Klingon bird of prey in Golden Gate park:
Everybody remember where we parked.
"""
And the file "examples/html/document.html" should contain exactly:
"""
"""
Scenario: Regenerate outdated output examples specified by filter
When I run `bundle exec rake doctest:generate PATTERN="*:*attribution" FORCE=yes`
Then the output should contain:
"""
Generating test examples *:*attribution in examples/html
--> Rewriting quote:with-attribution
"""
And the file "examples/html/quote.html" should contain exactly:
"""
Four score and seven years ago our fathers brought forth
on this continent a new nation…
Everybody remember
where we parked.
A person who never made a mistake never tried anything new.
— Albert Einstein
"""