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.7.5 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.3.0/spec/acceptance/definition_spec.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.0.0/spec/acceptance/definition_spec.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.2.0/spec/acceptance/definition_spec.rb
challah-1.0.0.beta vendor/bundle/gems/factory_girl-4.1.0/spec/acceptance/definition_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/factory_girl-4.1.0/spec/acceptance/definition_spec.rb