Skip to content

Commit

Permalink
Fix ActiveModel attribute misdetection
Browse files Browse the repository at this point in the history
  • Loading branch information
viralpraxis committed Aug 13, 2024
1 parent bb099dc commit f519d0d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [Unreleased]

## [1.0.4] - 2024-08-13

- Fix `ActiveModel` attribute misdetection [(#4)](https://github.com/viralpraxis/rspec-description_consistency/pull/4)

## [1.0.3] - 2024-07-04

- Fix invalid private method verification [(#3)](https://github.com/viralpraxis/rspec-description_consistency/pull/3)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rspec-description_consistency (1.0.3)
rspec-description_consistency (1.0.4)

GEM
remote: https://rubygems.org/
Expand Down
5 changes: 2 additions & 3 deletions lib/rspec/description_consistency/consitency_verifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ def correct_method_example_group?(description, klass, include_private:)

if description.start_with?('#')
return true if klass.instance_methods.include?(method_name)
return false unless include_private
return true if klass.private_instance_methods.include?(method_name)
return true if klass.respond_to?(:attribute_names) && klass.attribute_names.include?(method_name.to_s)

klass.respond_to?(:attribute_names) && klass.attribute_names.include?(method_name.to_s)
include_private && klass.private_instance_methods.include?(method_name)
elsif description.start_with?('.')
correct_class_method?(method_name, klass, include_private: include_private)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/description_consistency/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Rspec
module DescriptionConsistency
VERSION = '1.0.3'
VERSION = '1.0.4'
end
end

0 comments on commit f519d0d

Please sign in to comment.