2011-05-19 10:56:45 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2011-09-23 13:14:02 -04:00
|
|
|
describe FactoryGirl::Declaration::Implicit do
|
2011-11-22 18:01:01 -05:00
|
|
|
let(:name) { :author }
|
|
|
|
let(:proxy) { stub("proxy") }
|
|
|
|
let(:declaration) { FactoryGirl::Declaration::Implicit.new(name) }
|
|
|
|
subject { declaration.to_attributes.first }
|
2011-05-19 10:56:45 -04:00
|
|
|
|
|
|
|
context "with a known factory" do
|
|
|
|
before do
|
2011-08-12 22:06:10 -04:00
|
|
|
FactoryGirl.factories.stubs(:registered? => true)
|
2011-05-19 10:56:45 -04:00
|
|
|
end
|
|
|
|
|
2011-11-22 18:01:01 -05:00
|
|
|
it { should be_association }
|
|
|
|
its(:factory) { should == name }
|
2011-05-19 10:56:45 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context "with a known sequence" do
|
2011-11-22 18:01:01 -05:00
|
|
|
before do
|
|
|
|
FactoryGirl.sequences.stubs(:registered? => true)
|
2011-09-23 13:14:02 -04:00
|
|
|
end
|
2011-05-19 10:56:45 -04:00
|
|
|
|
2011-11-22 18:01:01 -05:00
|
|
|
it { should_not be_association }
|
|
|
|
it { should be_a(FactoryGirl::Attribute::Sequence) }
|
2011-05-19 10:56:45 -04:00
|
|
|
end
|
|
|
|
end
|