1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00

Refactor definition_proxy_spec

This introduces a couple of things: firstly, there's now a MockFactory
that allows for introspection instead of spying all over the place. This
should make tests a lot less brittle. Secondly, a couple of handy
matchers have been made available to perform assertions against the
mock.
This commit is contained in:
Joshua Clayton 2011-10-14 15:14:43 -04:00
parent 41f73b5e39
commit 180eb8bec7
11 changed files with 326 additions and 156 deletions

View file

@ -0,0 +1,9 @@
RSpec::Matchers.define :have_trait do |trait_name|
match do |instance|
instance.traits.include?(FactoryGirl::Trait.new(trait_name, &@block))
end
chain :with_block do |block|
@block = block
end
end