{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/smart-answers/issues/2523","repository_url":"https://api.github.com/repos/alphagov/smart-answers","labels_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2523/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2523/comments","events_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2523/events","html_url":"https://github.com/alphagov/smart-answers/pull/2523","id":154446059,"number":2523,"title":"Fix stubbing of current time in regression tests","user":{"login":"floehopper","id":3169,"avatar_url":"https://avatars.githubusercontent.com/u/3169?v=3","gravatar_id":"","url":"https://api.github.com/users/floehopper","html_url":"https://github.com/floehopper","followers_url":"https://api.github.com/users/floehopper/followers","following_url":"https://api.github.com/users/floehopper/following{/other_user}","gists_url":"https://api.github.com/users/floehopper/gists{/gist_id}","starred_url":"https://api.github.com/users/floehopper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floehopper/subscriptions","organizations_url":"https://api.github.com/users/floehopper/orgs","repos_url":"https://api.github.com/users/floehopper/repos","events_url":"https://api.github.com/users/floehopper/events{/privacy}","received_events_url":"https://api.github.com/users/floehopper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-12T10:12:22Z","updated_at":"2016-05-12T10:23:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2523","html_url":"https://github.com/alphagov/smart-answers/pull/2523","diff_url":"https://github.com/alphagov/smart-answers/pull/2523.diff","patch_url":"https://github.com/alphagov/smart-answers/pull/2523.patch"},"body":"Since #2518 was merged, when multiple regression tests were run the call to `Timecop.freeze` in the `setup` block was only being made the first time the `setup` block was executed. This is because of the optimisation introduced in [this commit][1].\r\n\r\nIt so happens that #2518 changed the stubbed value of current time in the first flow, `additional-commodity-code`, to `2016-05-05` i.e. different from the value used to generate the artefacts for the majority of the flows. So when running all the regression tests, the stubbed value of current time was set to the value for `additional-commodity-code` and never changed. This caused the full regression test suite to fail on the `govuk_smart_answers_regressions` CI server.\r\n\r\nThis commit moves the call to `Timecop.freeze` before the condition which skips the `setup` on subsequent tests. This means that it is now executed for every test and the appropriate values of current time should be used for each flow.\r\n\r\nI didn't spot this sooner, because I didn't run all the regression tests before merging #2518. This was because having run the regression tests for a number of the flows individually, I mistakenly convinced myself that running all of them wasn't necessary.\r\n\r\n[1]: c86ba038821012a70cb5d8ee3c462fd6f9c5e53c"},"comment":{"url":"https://api.github.com/repos/alphagov/smart-answers/issues/comments/218718045","html_url":"https://github.com/alphagov/smart-answers/pull/2523#issuecomment-218718045","issue_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2523","id":218718045,"user":{"login":"floehopper","id":3169,"avatar_url":"https://avatars.githubusercontent.com/u/3169?v=3","gravatar_id":"","url":"https://api.github.com/users/floehopper","html_url":"https://github.com/floehopper","followers_url":"https://api.github.com/users/floehopper/followers","following_url":"https://api.github.com/users/floehopper/following{/other_user}","gists_url":"https://api.github.com/users/floehopper/gists{/gist_id}","starred_url":"https://api.github.com/users/floehopper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floehopper/subscriptions","organizations_url":"https://api.github.com/users/floehopper/orgs","repos_url":"https://api.github.com/users/floehopper/repos","events_url":"https://api.github.com/users/floehopper/events{/privacy}","received_events_url":"https://api.github.com/users/floehopper/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T10:23:17Z","updated_at":"2016-05-12T10:23:17Z","body":"I've just run all the regression tests locally on this branch and they all pass. So I think this fix is OK to merge."}}