rspec-description_consistency 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0f2e9e090d2bc3707eae5656451fcb48932777e8eee53d9efee4741ae04dfb2
4
- data.tar.gz: 8f9e93d88a4e81c1d9f7c30da88747db0a14f8b629dd488d0b0b9a9390140d6b
3
+ metadata.gz: ddd806c67283809955e71203d7d6990c82425076b46fdb17792a2a36a5aeb025
4
+ data.tar.gz: bfdf469f31d3b0975fe7d222ac71c166ebb012931a7b9bcfe8dcfbd5826c91c9
5
5
  SHA512:
6
- metadata.gz: f8e9e8cdab51a8e86bf8dc611a9c9df71bea86161d4884914908b2b558ca8d409c284d1b39e35e1cba3612b85492b1b9436a77b50306c1c9546bacfa0e6dc266
7
- data.tar.gz: 832491c5965120ff2bdf6e4dabfa099a7b59f41b2f34860b638bfec96e676040708f9606c37681f8e601e5c84e678b6aa03a357a32bf5f7bfb88a3659afd7be4
6
+ metadata.gz: 7d495fdd45eaa7577d85bcff0c63c8cff8d30f4929976fe5c573c500643700ad592475be6973c5c6cba97c7749dda6d99c7328a83fdeb7ec127b111deaf263a3
7
+ data.tar.gz: ae235e216f260506492e481a60d6f0fd76462b3c17c72cd245d8c3a047f196ae2898487c7e870f71bb600457c4f2c8c9c85624dc8f3a5184b896cc2158e0361d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2024-03-14
3
+ ## [1.0.1] - 2024-07-04
4
+
5
+ - Fix incorrect instance method check in case of dynamically defined methods [(#1)](https://github.com/viralpraxis/rspec-description_consistency/pull/1)
6
+
7
+ ## [1.0.0] - 2024-07-03
4
8
 
5
9
  - Initial release
data/README.md CHANGED
@@ -35,15 +35,13 @@ This gem enforces consistency by checking descriptions against the described obj
35
35
 
36
36
  ## Installation
37
37
 
38
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
39
-
40
38
  Install the gem and add to the application's Gemfile by executing:
41
39
 
42
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
40
+ $ bundle add rspec-description_consistency
43
41
 
44
42
  If bundler is not being used to manage dependencies, install the gem by executing:
45
43
 
46
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
44
+ $ gem install rspec-description_consistency
47
45
 
48
46
  ## Usage
49
47
 
@@ -44,23 +44,23 @@ module RSpec
44
44
  method_name = description[1..].to_sym
45
45
 
46
46
  if description.start_with?('#') && include_private
47
- klass.method_defined?(method_name) || klass.private_method_defined?(method_name)
47
+ klass.instance_methods.include?(method_name) || klass.private_instance_methods.include?(method_name)
48
48
  elsif description.start_with?('#')
49
- klass.method_defined?(method_name)
49
+ klass.instance_methods.include?(method_name)
50
50
  elsif description.start_with?('.')
51
51
  correct_class_method?(method_name, klass, include_private: include_private)
52
52
  end
53
53
  end
54
54
 
55
55
  def correct_class_method?(method_name, klass, include_private:)
56
- klass.singleton_class.method_defined?(method_name) ||
56
+ klass.singleton_class.instance_methods.include?(method_name) ||
57
57
  (include_private && klass.singleton_class.private_instance_methods.include?(method_name)) ||
58
58
  activesupport_concern?(method_name, klass)
59
59
  end
60
60
 
61
61
  def activesupport_concern?(method_name, klass)
62
62
  if klass.is_a?(Module) && klass.const_defined?(:ClassMethods) &&
63
- klass.const_get(:ClassMethods).method_defined?(method_name)
63
+ klass.const_get(:ClassMethods).instance_methods.include?(method_name)
64
64
  true
65
65
  else
66
66
  Object.const_defined?(:ActiveSupport) && ::ActiveSupport.const_defined?(:Concern) &&
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rspec
4
4
  module DescriptionConsistency
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-description_consistency
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iaroslav Kurbatov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-03 00:00:00.000000000 Z
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Automatic checking of consistency of descriptions in context and describe
14
14
  blocks, and class or module methods.