Sha256: 2b77d423721f31606824830e871483569e6b74a98dfaf9ade10bc9c25466f2a0
Contents?: true
Size: 1010 Bytes
Versions: 3
Compression:
Stored size: 1010 Bytes
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 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jsonapi-serializers-0.6.2 | spec/support/factory.rb |
jsonapi-serializers-0.6.1 | spec/support/factory.rb |
jsonapi-serializers-0.6.0 | spec/support/factory.rb |