spec/support/matchers/trait.rb in factory_girl-4.3.0 vs spec/support/matchers/trait.rb in factory_girl-4.4.0
- old
+ new
@@ -1,7 +1,9 @@
RSpec::Matchers.define :have_trait do |trait_name|
match do |instance|
- instance.defined_traits.include?(FactoryGirl::Trait.new(trait_name, &@block))
+ instance.defined_traits.any? do |trait|
+ trait.name == trait_name && trait.send(:block) == @block
+ end
end
chain :with_block do |block|
@block = block
end