Sha256: 2a03c5bf29e6cdf6f4df31adcecddbe63c9de94417fb0b3bf31f3fd3c1cd41f3

Contents?: true

Size: 1.09 KB

Versions: 20

Compression:

Stored size: 1.09 KB

Contents

require 'factory_girl'

FactoryGirl.define do
  factory :post, class: MyApp::Post do
    skip_create
    sequence(:id) {|n| n }
    sequence(:title) {|n| "Title for Post #{n}" }
    sequence(:body) {|n| "Body for Post #{n}" }

    trait :with_author do
      association :author, factory: :user
    end
  end

  # Post with some added property to test inheritance in serializer.
  factory :tagged_post, class: MyApp::TaggedPost do
    skip_create
    sequence(:id) {|n| n }
    sequence(:title) {|n| "Title for TaggedPost #{n}" }
    sequence(:body) {|n| "Body for TaggedPost #{n}" }
    sequence(:tag) {|n| "Tag for TaggedPost #{n}" }

    trait :with_author do
      association :author, factory: :user
    end
  end

  factory :long_comment, class: MyApp::LongComment do
    skip_create
    sequence(:id) {|n| n }
    sequence(:body) {|n| "Body for LongComment #{n}" }
  end

  factory :user, class: MyApp::User do
    skip_create
    sequence(:id) {|n| n }
    sequence(:name) {|n| "User ##{n}"}
  end

  factory :underscore_test, class: MyApp::UnderscoreTest do
    skip_create
    sequence(:id) {|n| n }
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
forestadmin-jsonapi-serializers-2.0.0.pre.beta.2 spec/support/factory.rb
jsonapi-serializers-2.0.0.pre.beta.2 spec/support/factory.rb
jsonapi-serializers-2.0.0.pre.beta.1 spec/support/factory.rb
jsonapi-serializers-1.0.1 spec/support/factory.rb
jsonapi-serializers-1.0.0 spec/support/factory.rb
jsonapi-serializers-0.16.2 spec/support/factory.rb
jsonapi-serializers-0.16.1 spec/support/factory.rb
jsonapi-serializers-0.16.0 spec/support/factory.rb
jsonapi-serializers-0.15.0 spec/support/factory.rb
jsonapi-serializers-0.14.0 spec/support/factory.rb
jsonapi-serializers-0.13.0 spec/support/factory.rb
jsonapi-serializers-0.12.0 spec/support/factory.rb
jsonapi-serializers-0.11.0 spec/support/factory.rb
jsonapi-serializers-0.10.0 spec/support/factory.rb
jsonapi-serializers-0.9.0 spec/support/factory.rb
jsonapi-serializers-0.8.0 spec/support/factory.rb
jsonapi-serializers-0.7.0 spec/support/factory.rb
jsonapi-serializers-0.6.5 spec/support/factory.rb
jsonapi-serializers-0.6.4 spec/support/factory.rb
jsonapi-serializers-0.6.3 spec/support/factory.rb