Class: RuboCop::Cop::RSpecRails::MinitestAssertions::PredicateAssertion
- Inherits:
-
BasicAssertion
- Object
- BasicAssertion
- RuboCop::Cop::RSpecRails::MinitestAssertions::PredicateAssertion
- Defined in:
- lib/rubocop/cop/rspec_rails/minitest_assertions.rb
Overview
:nodoc:
Constant Summary collapse
- MATCHERS =
%i[ assert_predicate assert_not_predicate refute_predicate ].freeze
Instance Attribute Summary
Attributes inherited from BasicAssertion
#actual, #expected, #failure_message
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BasicAssertion
#initialize, #negated?, #replaced
Constructor Details
This class inherits a constructor from RuboCop::Cop::RSpecRails::MinitestAssertions::BasicAssertion
Class Method Details
.match(subject, predicate, failure_message) ⇒ Object
198 199 200 201 202 |
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 198 def self.match(subject, predicate, ) return nil unless predicate.value.end_with?('?') new(predicate, subject, .first) end |
.minitest_assertion(node) ⇒ Object
194 195 |
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 194
def_node_matcher 'self.minitest_assertion', <<~PATTERN # rubocop:disable InternalAffairs/NodeMatcherDirective
(send nil? {:assert_predicate :assert_not_predic
|
Instance Method Details
#assertion ⇒ Object
204 205 206 |
# File 'lib/rubocop/cop/rspec_rails/minitest_assertions.rb', line 204 def assertion "be_#{expected.delete_prefix(':').delete_suffix('?')}" end |