2010-06-10 13:37:51 -04:00
|
|
|
require 'spec_helper'
|
2009-04-11 11:27:23 -04:00
|
|
|
|
2010-06-24 09:45:57 -04:00
|
|
|
describe FactoryGirl::Attribute::Static do
|
2011-08-13 01:03:12 -04:00
|
|
|
let(:name) { :first_name }
|
|
|
|
let(:value) { "John" }
|
|
|
|
let(:proxy) { stub("proxy") }
|
2009-04-11 11:27:23 -04:00
|
|
|
|
2011-10-07 18:19:27 -04:00
|
|
|
subject { FactoryGirl::Attribute::Static.new(name, value, false) }
|
2009-04-11 11:27:23 -04:00
|
|
|
|
2011-08-13 01:03:12 -04:00
|
|
|
its(:name) { should == name }
|
2009-04-11 11:27:23 -04:00
|
|
|
|
2011-08-13 01:03:12 -04:00
|
|
|
it "sets its static value on a proxy" do
|
|
|
|
proxy.stubs(:set)
|
|
|
|
subject.add_to(proxy)
|
2011-11-01 17:00:26 -04:00
|
|
|
proxy.should have_received(:set).with(subject, value)
|
2009-04-11 11:27:23 -04:00
|
|
|
end
|
2011-08-13 01:03:12 -04:00
|
|
|
end
|
2009-04-11 11:27:23 -04:00
|
|
|
|
2011-08-13 01:03:12 -04:00
|
|
|
describe FactoryGirl::Attribute::Static, "with a string name" do
|
2011-10-07 18:19:27 -04:00
|
|
|
subject { FactoryGirl::Attribute::Static.new("name", nil, false) }
|
2011-08-13 01:03:12 -04:00
|
|
|
its(:name) { should == :name }
|
2009-04-11 11:27:23 -04:00
|
|
|
end
|