Sha256: bfcfd64dc606af7098dd623e99bffb981610da72e4611b32aef513adde2c6514

Contents?: true

Size: 830 Bytes

Versions: 13

Compression:

Stored size: 830 Bytes

Contents

require 'spec_helper'
require 'acceptance/acceptance_helper'

describe "sequences" do
  include FactoryGirl::Syntax::Methods

  it "generates several values in the correct format" do
    FactoryGirl.define do
      sequence :email do |n|
        "somebody#{n}@example.com"
      end
    end

    first_value = generate(:email)
    another_value = generate(:email)

    first_value.should =~ /^somebody\d+@example\.com$/
    another_value.should =~ /^somebody\d+@example\.com$/
    first_value.should_not == another_value
  end

  it "generates sequential numbers if no block is given" do
    FactoryGirl.define do
      sequence :order
    end

    first_value = generate(:order)
    another_value = generate(:order)

    first_value.should == 1
    another_value.should == 2
    first_value.should_not == another_value
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
factory_girl-2.0.4 spec/acceptance/sequence_spec.rb
factory_girl-2.0.3 spec/acceptance/sequence_spec.rb
factory_girl-2.0.2 spec/acceptance/sequence_spec.rb
factory_girl-2.0.1 spec/acceptance/sequence_spec.rb
factory_girl-2.0.0.rc4 spec/acceptance/sequence_spec.rb
factory_girl-2.0.0.rc3 spec/acceptance/sequence_spec.rb
factory_girl-2.0.0.rc2 spec/acceptance/sequence_spec.rb
factory_girl-2.0.0.rc1 spec/acceptance/sequence_spec.rb
factory_girl-2.0.0.beta5 spec/acceptance/sequence_spec.rb
factory_girl-2.0.0.beta4 spec/acceptance/sequence_spec.rb
factory_girl-2.0.0.beta3 spec/acceptance/sequence_spec.rb
factory_girl_kibiz0r-2.0.0.beta3 spec/acceptance/sequence_spec.rb
factory_girl_kibiz0r-2.0.0.beta2 spec/acceptance/sequence_spec.rb