Sha256: 05380a7db4b19da7298532dfb5e9002370c11504176b8904d344d26dd68f581e

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

FactoryGirl.define do
  factory :parent_resource do
    r_boolean true
    r_date Date.today
    r_datetime DateTime.now
    r_decimal 3.14
    r_float 3.14
    r_integer 3
    r_string "my string"
    r_text "my text"
    r_time Time.now

    factory :parent_with_children do
        ignore do
            children_count 3
        end

        after(:create) do |parent, evaluator|
            create_list(:child_resource, evaluator.children_count, parent_resource: parent)
        end
    end

    factory :parent_with_grand_children do
        ignore do
            children_count 3
        end

        after(:create) do |parent, evaluator|
            create_list(:child_with_grand_children, evaluator.children_count,
                parent_resource: parent)
        end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
controlled_versioning-0.7.2 spec/factories/parent_resources.rb