2010-11-12 15:58:25 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "an instance generated by a factory with a custom class name" do
|
|
|
|
before do
|
2012-03-09 17:20:38 -05:00
|
|
|
define_model("User", admin: :boolean)
|
2010-11-12 15:58:25 -05:00
|
|
|
|
|
|
|
FactoryGirl.define do
|
2011-06-29 14:43:15 -04:00
|
|
|
factory :user
|
2010-11-12 15:58:25 -05:00
|
|
|
|
2012-03-09 17:20:38 -05:00
|
|
|
factory :admin, class: User do
|
2010-11-12 15:58:25 -05:00
|
|
|
admin { true }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-01-19 19:47:49 -05:00
|
|
|
subject { FactoryGirl.create(:admin) }
|
2010-11-12 15:58:25 -05:00
|
|
|
|
|
|
|
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
|
|
|
|
|