Sha256: e5f9d44366ea8bb636aa01cc828bae4f4e19b22dd43451644a081586eac061d6

Contents?: true

Size: 1.24 KB

Versions: 42

Compression:

Stored size: 1.24 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" }
    its(:default_strategy) { should == :create }

    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

42 entries across 37 versions & 3 rubygems

Version Path
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/factory_girl-2.6.4/spec/factory_girl/sequence_spec.rb
challah-0.6.2 vendor/bundle/gems/factory_girl-2.6.1/spec/factory_girl/sequence_spec.rb
challah-0.6.1 vendor/bundle/gems/factory_girl-2.5.1/spec/factory_girl/sequence_spec.rb
challah-0.6.1 vendor/bundle/gems/factory_girl-2.6.1/spec/factory_girl/sequence_spec.rb
challah-0.6.0 vendor/bundle/gems/factory_girl-2.5.1/spec/factory_girl/sequence_spec.rb
challah-0.6.0 vendor/bundle/gems/factory_girl-2.6.1/spec/factory_girl/sequence_spec.rb
challah-0.5.4 vendor/bundle/gems/factory_girl-2.5.1/spec/factory_girl/sequence_spec.rb
challah-0.5.4 vendor/bundle/gems/factory_girl-2.6.1/spec/factory_girl/sequence_spec.rb
challah-0.5.3 vendor/bundle/gems/factory_girl-2.5.1/spec/factory_girl/sequence_spec.rb
challah-0.5.3 vendor/bundle/gems/factory_girl-2.6.1/spec/factory_girl/sequence_spec.rb
challah-0.5.2 vendor/bundle/gems/factory_girl-2.6.1/spec/factory_girl/sequence_spec.rb
challah-0.5.2 vendor/bundle/gems/factory_girl-2.5.1/spec/factory_girl/sequence_spec.rb
factory_girl-2.6.4 spec/factory_girl/sequence_spec.rb
factory_girl-2.6.3 spec/factory_girl/sequence_spec.rb
factory_girl-2.6.2 spec/factory_girl/sequence_spec.rb
challah-0.5.1 vendor/bundle/gems/factory_girl-2.6.1/spec/factory_girl/sequence_spec.rb
factory_girl-2.6.1 spec/factory_girl/sequence_spec.rb
challah-0.5.0 vendor/bundle/gems/factory_girl-2.5.1/spec/factory_girl/sequence_spec.rb
factory_girl-2.6.0 spec/factory_girl/sequence_spec.rb
factory_girl-2.5.2 spec/factory_girl/sequence_spec.rb