Skip to content

Commit

Permalink
Avoid enum issue (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
djezzzl committed Jun 15, 2023
1 parent 1dcd9f2 commit 7ba2052
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/factory_trace/monkey_patches/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module MonkeyPatches
module Factory
attr_reader :definition_path

def initialize(name, definition_path, options = {})
def initialize(name, definition_path = "", options = {})
@definition_path = definition_path
super(name, options)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/factory_trace/monkey_patches/trait.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module MonkeyPatches
module Trait
attr_reader :definition_path

def initialize(name, definition_path, &block)
def initialize(name, definition_path = "", &block)
@definition_path = definition_path
super(name, &block)
end
Expand Down
1 change: 1 addition & 0 deletions rails7/app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class User < ApplicationRecord
attr_accessor :visibility
end
2 changes: 2 additions & 0 deletions rails7/spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

FactoryBot.define do
factory :user do
traits_for_enum :visibility, [:public, :private]

trait :with_phone do
phone { "phone" }
end
Expand Down

0 comments on commit 7ba2052

Please sign in to comment.