Commit
It's possible that a change in the flow and its corresponding test data may mean that no outcome artefact is generated for one that exists in the git repo. However, as the code stood, we would not detect this, because the assertion diffs were only being done for the individual outcome artefacts. This change means that we do a diff for the directory as a whole after all the response combinations have been tried and the assertion fails if there are any differences. Unfortunately, because Minitest doesn't have an equivalent of RSpec's `after(:all)`, we have to use some slightly nasty code to run our new test at the end of all the tests for a given flow.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
require 'gds_api/test_helpers/content_api' | ||
|
||
class SmartAnswerResponsesAndExpectedResultsTest < ActionController::TestCase | ||
self.i_suck_and_my_tests_are_order_dependent! | ||
RUN_ME_LAST = 'zzzzzzzzzzz run me last' | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
floehopper
Author
Contributor
|
||
|
||
include GdsApi::TestHelpers::ContentApi | ||
|
||
tests SmartAnswersController | ||
|
@@ -40,6 +43,11 @@ class SmartAnswerResponsesAndExpectedResultsTest < ActionController::TestCase | |
end | ||
end | ||
end | ||
|
||
should "#{RUN_ME_LAST} and generate the same set of output files" do | ||
diff_output = `git diff --stat #{smart_answer_helper.path_to_outputs_for_flow}` | ||
assert_equal '', diff_output, "Unexpected difference in outputs for flow:" | ||
end | ||
end | ||
end | ||
end |
How does this work?
Can we have assertions in the teardown method of the context?