Permalink
Browse files

Mention new verify_constant_names option in the README.

  • Loading branch information...
1 parent 4691ff7 commit 63522b253e694435e106eefbfcd1666225e8bf6e @myronmarston myronmarston committed Jul 10, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 README.md
View
@@ -173,6 +173,22 @@ Particularly handy for `ActiveRecord` finders. Use `fire_class_double`. If you
dig into the code, you'll find you can create subclasses of `FireDouble` to
check for *any* set of methods.
+### Preventing Typo'd Constant Names
+
+`fire_double("MyClas")` will not verify any mocked methods, even when
+`MyClass` is loaded, because of the typo in the constant name. There's
+an option to help prevent these sorts of fat-finger errors:
+
+ RSpec::Fire.configure do |config|
+ config.verify_constant_names = true
+ end
+
+When this is set to true, rspec-fire will raise an error when given
+the name of an undefined constant. You probably only want to set this
+when running your entire test suite, with all production code loaded.
+Setting this for an isolated unit test will prevent you from being
+able to isolate it!
+
### Mocking Done Right (tm)
* Only mock methods on collaborators, _not_ the class under test.

0 comments on commit 63522b2

Please sign in to comment.