Skip to content

Commit

Permalink
Apply reviewer's comments
Browse files Browse the repository at this point in the history
- Refactor verifier logic
- Nest all specs in one `describe` block

Co-authored-by: Jose Blanco <jose.blanco@thoughtbot.com>
  • Loading branch information
rhannequin and laicuRoot committed Feb 23, 2024
1 parent dedadd9 commit f3c02f3
Show file tree
Hide file tree
Showing 3 changed files with 312 additions and 308 deletions.
Expand Up @@ -13,13 +13,7 @@ def initialize(reflection)
end

def associated_class
associated_class = reflection.klass

if subject.strict_loading_by_default && !(reflection.options[:strict_loading] == false)
reflection.options[:strict_loading] = true
end

associated_class
reflection.klass
end

def polymorphic?
Expand Down Expand Up @@ -76,6 +70,10 @@ def has_and_belongs_to_many_name
reflection.options[:through]
end

def strict_loading?
reflection.options.fetch(:strict_loading, subject.strict_loading_by_default)
end

protected

attr_reader :reflection, :subject
Expand Down
Expand Up @@ -122,6 +122,10 @@ def actual_value_for_class_name
reflector.associated_class
end

def actual_value_for_strict_loading
reflection.strict_loading?
end

def actual_value_for_option(name)
option_value = reflection.options[name]

Expand Down

0 comments on commit f3c02f3

Please sign in to comment.