mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
20 lines
548 B
Ruby
20 lines
548 B
Ruby
require 'spec_helper'
|
|
|
|
describe FactoryGirl::Attribute::Sequence do
|
|
before do
|
|
@name = :first_name
|
|
@sequence = :name
|
|
FactoryGirl.register_sequence(FactoryGirl::Sequence.new(@sequence, 5) { |n| "Name #{n}" })
|
|
@attr = FactoryGirl::Attribute::Sequence.new(@name, @sequence)
|
|
end
|
|
|
|
it "should have a name" do
|
|
@attr.name.should == @name
|
|
end
|
|
|
|
it "assigns the next value in the sequence" do
|
|
proxy = stub("proxy", :set => nil)
|
|
@attr.add_to(proxy)
|
|
proxy.should have_received(:set).with(@name, "Name 5")
|
|
end
|
|
end
|