Sha256: a6b2ef5dbb76afc483da2568dbf597de22db0a5c010c18fd46e40314d59702c9

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

require 'test_helper'

class FabricatorsTest < ActiveSupport::TestCase

  setup do
    Fabricators.define do
      fabricator :user do
        name 'name'
      end
    end
  end

  test "return attributes" do
    hash = attributes_for(:user)
    assert_kind_of Hash, hash
    assert_equal 'name', hash[:name]
  end
 
  test "build instance" do
    record = build(:user)
    assert_kind_of User, record
    assert record.new_record?
    assert_equal 'name', record.name
  end

  test "create instance" do
    record = create(:user)
    assert_kind_of User, record
    assert record.persisted?
    assert_equal 'name', record.name
  end
 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fabricators-0.0.4 test/fabricators_test.rb
fabricators-0.0.1 test/fabricators_test.rb