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:
parent
41f73b5e39
commit
180eb8bec7
11 changed files with 326 additions and 156 deletions
9
spec/support/matchers/trait.rb
Normal file
9
spec/support/matchers/trait.rb
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue