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

Both Factory and Trait have similar methods and interact with a DefinitionProxy. The idea here is to move the interface DefinitionProxy expects to a separate class and both Factory and Trait can delegate to an instance of Definition.
9 lines
222 B
Ruby
9 lines
222 B
Ruby
RSpec::Matchers.define :have_trait do |trait_name|
|
|
match do |instance|
|
|
instance.defined_traits.include?(FactoryGirl::Trait.new(trait_name, &@block))
|
|
end
|
|
|
|
chain :with_block do |block|
|
|
@block = block
|
|
end
|
|
end
|