opscode/chef — pull request #355 by lamont-opscode (2012-08-09 23:26:59+00:00)
Title: we're doing more of a functional test here which requires the file to ex...

...ist for the tests to work as intended.

the problem here is that we're doing something closer to a func test than a unit test, and if the file does not exist then other checks in the file provider will cause the resource to get updated if the file does not exist.

the simplest thing to do is to just make sure that the file exists before calling the provider. it was working a lot of the time before because the first time you ran the tests, it would fail, but in the process it would create the file, the second time through the file would exist so it would work. this changes it to create a random tmpdir and then create the file before running the rest of the tests.

the point of the test is to exercise the mixin, not the code within the file provider that the bug is exercising so we're not losing any coverage by doing this.

otherwise, we'd need to start littering the test with more mocks and stubs and make it even more confusing.