Sha256: 99b9e048c47685399e87e49e83cf0d3486ecb0d76cb060cbbc226adb160e2fe7

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

require 'test_helper'

class AttributesTest < ActiveSupport::TestCase

  setup do
    Fabricators.define do
      fabricator :user do
        sequence(:email) { |n| "mail#{n}@example.com" }
        sequence(:age)
      end
    end
  end

  test 'block sequence' do
    assert_equal 'mail1@example.com', attributes_for(:user)[:email]
    assert_equal 'mail2@example.com', build(:user).email
    assert_equal 'mail3@example.com', create(:user).email
  end

  test 'numeric sequence' do
    assert_equal 1, attributes_for(:user)[:age]
    assert_equal 2, build(:user).age
    assert_equal 3, create(:user).age
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fabricators-0.1.2 test/attributes_test.rb
fabricators-0.1.1 test/attributes_test.rb