Sha256: 559824006a93c20e828304255e8b1c64043779a8e43e08318ed6c9c8ec51bce4

Contents?: true

Size: 476 Bytes

Versions: 201

Compression:

Stored size: 476 Bytes

Contents

require 'spec_helper'

describe "an instance generated by a factory with a custom class name" do
  before do
    define_model("User", admin: :boolean)

    FactoryGirl.define do
      factory :user

      factory :admin, class: User do
        admin { true }
      end
    end
  end

  subject { FactoryGirl.create(:admin) }

  it "uses the correct class name" do
    should be_kind_of(User)
  end

  it "uses the correct factory definition" do
    should be_admin
  end
end

Version data entries

201 entries across 93 versions & 7 rubygems

Version Path
classiccms-0.6.0 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.6.0 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
challah-0.8.1 vendor/bundle/gems/factory_girl-4.0.0/spec/acceptance/definition_spec.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
factory_girl-4.1.0 spec/acceptance/definition_spec.rb
classiccms-0.5.14 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.5.14 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.5.14 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.5.13 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.5.13 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.5.13 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.5.12 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb