thoughtbot--factory_bot/spec/support/matchers/trait.rb

10 lines
214 B
Ruby

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