Closed kellyredding closed 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:
assert
bin and the cli.rb files (these aren't tested explicitly and don't benefit from an injected config, plus don't know how I would inject one anyway)self.method_added
, self.test
, self.test_eventually
. This is b/c they are singleton methods and I don't want to alter their api to allow injecting a config.Assert.config
. This is the default if no config is given. This is different from other things that need a config (they expect it to always be given). But views may be extended by 3rd-party tools/users and I didn't want them to always have to pass a config in. Therefore, passing in a config is optional and defaults to Assert.config
. On the other things I don't mind always passing in a config b/c its internal stuff.@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.
@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).
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.