Permalink
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (15 sloc) 447 Bytes
require 'spec_helper'
describe 'defining methods inside FactoryBot' do
it 'raises with a meaningful message' do
define_model('User')
expect do
FactoryBot.define do
factory :user do
def generate_name
'John Doe'
end
end
end
end.to raise_error FactoryBot::MethodDefinitionError, /Defining methods in blocks \(trait or factory\) is not supported \(generate_name\)/
end
end