Sha256: 5a20cb276f7a74fb6c6aa53835e29f9663a84425fbfc315119193a75a00b5a21

Contents?: true

Size: 450 Bytes

Versions: 11

Compression:

Stored size: 450 Bytes

Contents

require 'spec_helper'

describe 'defining methods inside FactoryGirl' do
  it 'raises with a meaningful message' do
    define_model('User')

    expect do
      FactoryGirl.define do
        factory :user do
          def generate_name
            'John Doe'
          end
        end
      end
    end.to raise_error FactoryGirl::MethodDefinitionError, /Defining methods in blocks \(trait or factory\) is not supported \(generate_name\)/
  end
end

Version data entries

11 entries across 8 versions & 4 rubygems

Version Path
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/factory_girl-4.5.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/factory_girl-4.5.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/factory_girl-4.5.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/factory_girl-4.5.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/acceptance/defining_methods_inside_a_factory_spec.rb
factory_girl-4.5.0 spec/acceptance/defining_methods_inside_a_factory_spec.rb
factory_girl-4.4.0 spec/acceptance/defining_methods_inside_a_factory_spec.rb
factory_girl-4.3.0 spec/acceptance/defining_methods_inside_a_factory_spec.rb