redding / assert

Assertion style testing framework.
https://github.com/redding/assert
MIT License
10 stars 1 forks source link

non-singleton Config class #166

Closed kellyredding closed 10 years ago

kellyredding commented 10 years ago

This switches from using a singleton config implementation to a memoized instance config implementation. The behavior has not changed, just the way it is accessed. All config values are accessed via the Assert.config config instance.

The main reason for doing this is that has no effect on the external API but allows for much easier and robust testing of the configs and their default values without impacting live code. This also removes the need to restrict any config settings for running the test suite. The two concerns are properly separated.

To accomplish this, I have to now inject the config to everything that needs it. Most of the changes here are adding in the injection to the object's API and updating the tests appropriately.

Closes #154.

@jcredding ready for review. Sorry the diff is ridiculous. I'll make a few notes to guide you.

kellyredding commented 10 years ago

@jcredding most of the changes here are from me updating things to now have the config injected instead of them just calling the Assert.config global.

Now, I wanted to keep the Assert.config api around to not break the api and b/c it is convenient to use in some situations. It is still in use in a few places in the code:

kellyredding commented 10 years ago

@jcredding there is some "noise" b/c I would go in and modernize the old test files and cleanup to get on our latest standards when I was updating them. Sorry for the noise.

jcredding commented 10 years ago

@kellyredding - Looks good :boom: Your description of the changes was good and makes sense. I like the removals of the test helper and singleton-managing (save off setting, run tests, set the setting back).