Sha256: 802504839c5629ffd515599f02ce649451bcfd04f64f191ae7a6a7e885bcbf32

Contents?: true

Size: 1.16 KB

Versions: 57

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe FactoryGirl::Sequence do
  describe "a basic sequence" do
    let(:name) { :test }
    subject    { FactoryGirl::Sequence.new(name) {|n| "=#{n}" } }

    its(:name)  { should == name }
    its(:names) { should == [name] }
    its(:next)  { should == "=1" }

    describe "when incrementing" do
      before     { subject.next }
      its(:next) { should == "=2" }
    end
  end

  describe "a custom sequence" do
    subject    { FactoryGirl::Sequence.new(:name, "A") {|n| "=#{n}" } }
    its(:next) { should == "=A" }

    describe "when incrementing" do
      before     { subject.next }
      its(:next) { should == "=B" }
    end
  end

  describe "a basic sequence without a block" do
    subject    { FactoryGirl::Sequence.new(:name) }
    its(:next) { should == 1 }

    describe "when incrementing" do
      before     { subject.next }
      its(:next) { should == 2 }
    end
  end

  describe "a custom sequence without a block" do
    subject    { FactoryGirl::Sequence.new(:name, "A") }
    its(:next) { should == "A" }

    describe "when incrementing" do
      before     { subject.next }
      its(:next) { should == "B" }
    end
  end
end

Version data entries

57 entries across 57 versions & 4 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.9 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.8 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.7 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.6 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.5 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.4 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.3 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.2 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.1 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.6.0 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.5.17 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.5.16 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.5.15 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb
classiccms-0.5.14 vendor/bundle/gems/factory_girl-3.0.0/spec/factory_girl/sequence_spec.rb