1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/spec/support/matchers/trait.rb
Joshua Clayton 41bc3ac5ff Add FactoryGirl::Definition
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.
2011-10-30 23:17:03 -04:00

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