Sha256: cb26c541a714f24b1210c0156bd70d0b4a0805aebcaa7fd1ad397e1f03ab0f61

Contents?: true

Size: 539 Bytes

Versions: 10

Compression:

Stored size: 539 Bytes

Contents

require 'spec_helper'

describe 'finding factories keyed by class instead of symbol' do
  before do
    define_model("User") do
      attr_accessor :name, :email
    end

    FactoryGirl.define do
      factory :user do
        name 'John Doe'
        sequence(:email) { |n| "person#{n}@example.com" }
      end
    end
  end

  it 'allows interaction based on class name' do
    user = FactoryGirl.create User, email: 'person@example.com'
    expect(user.email).to eq 'person@example.com'
    expect(user.name).to eq 'John Doe'
  end
end

Version data entries

10 entries across 7 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/keyed_by_class_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/factory_girl-4.5.0/spec/acceptance/keyed_by_class_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/factory_girl-4.5.0/spec/acceptance/keyed_by_class_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/factory_girl-4.5.0/spec/acceptance/keyed_by_class_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/factory_girl-4.4.0/spec/acceptance/keyed_by_class_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/factory_girl-4.4.0/spec/acceptance/keyed_by_class_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/keyed_by_class_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/keyed_by_class_spec.rb
factory_girl-4.5.0 spec/acceptance/keyed_by_class_spec.rb
factory_girl-4.4.0 spec/acceptance/keyed_by_class_spec.rb