Sha256: e599d44e57a5cbad50bb4ecc27f0ec70689a2fa732fa3d649ea1e85ce3bdcee6

Contents?: true

Size: 521 Bytes

Versions: 10

Compression:

Stored size: 521 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

      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

10 entries across 10 versions & 1 rubygems

Version Path
factory_girl-2.0.4 spec/acceptance/definition_spec.rb
factory_girl-2.0.3 spec/acceptance/definition_spec.rb
factory_girl-2.0.2 spec/acceptance/definition_spec.rb
factory_girl-2.0.1 spec/acceptance/definition_spec.rb
factory_girl-2.0.0.rc4 spec/acceptance/definition_spec.rb
factory_girl-2.0.0.rc3 spec/acceptance/definition_spec.rb
factory_girl-2.0.0.rc2 spec/acceptance/definition_spec.rb
factory_girl-2.0.0.rc1 spec/acceptance/definition_spec.rb
factory_girl-2.0.0.beta5 spec/acceptance/definition_spec.rb
factory_girl-2.0.0.beta4 spec/acceptance/definition_spec.rb