Sha256: 1851a8c1179fed42dfe12c4297540ce9e86f88888f898314f17eb4b5d5dcbc90

Contents?: true

Size: 791 Bytes

Versions: 99

Compression:

Stored size: 791 Bytes

Contents

require 'spec_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

99 entries across 90 versions & 5 rubygems

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