Nested factories

You can create multiple factories for the same class without repeating common attributes by nesting factories:

factory :post do
  title { "A title" }

  factory :approved_post do
    approved { true }
  end
end

approved_post = create(:approved_post)
approved_post.title    # => "A title"
approved_post.approved # => true