Sha256: 108ca8a30475f6a756050f2335a57d8eac345dc23a50b00fd9c85934fab5c49c

Contents?: true

Size: 534 Bytes

Versions: 4

Compression:

Stored size: 534 Bytes

Contents

require 'spec_helper'
require 'acceptance/acceptance_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 do
      end

      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

4 entries across 4 versions & 2 rubygems

Version Path
factory_girl-2.0.0.beta3 spec/acceptance/definition_spec.rb
factory_girl_kibiz0r-2.0.0.beta3 spec/acceptance/definition_spec.rb
factory_girl_kibiz0r-2.0.0.beta2 spec/acceptance/definition_spec.rb
factory_girl-2.0.0.beta2 spec/acceptance/definition_spec.rb