Class: Expected::Matchers::ExtendModuleMatcher
- Inherits:
-
Object
- Object
- Expected::Matchers::ExtendModuleMatcher
- Defined in:
- lib/expected/matchers/extend_module.rb
Overview
Class used by #extend_module
Instance Attribute Summary collapse
-
#expected_module ⇒ Object
readonly
Returns the value of attribute expected_module.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
- #description ⇒ String
- #failure_message ⇒ String
- #failure_message_when_negated ⇒ String
-
#initialize(expected_module) ⇒ ExtendModuleMatcher
constructor
A new instance of ExtendModuleMatcher.
-
#matches?(subject) ⇒ True, False
Run the test.
Constructor Details
#initialize(expected_module) ⇒ ExtendModuleMatcher
Returns a new instance of ExtendModuleMatcher.
23 24 25 |
# File 'lib/expected/matchers/extend_module.rb', line 23 def initialize(expected_module) @expected_module = expected_module end |
Instance Attribute Details
#expected_module ⇒ Object (readonly)
Returns the value of attribute expected_module.
20 21 22 |
# File 'lib/expected/matchers/extend_module.rb', line 20 def expected_module @expected_module end |
#subject ⇒ Object
Returns the value of attribute subject.
20 21 22 |
# File 'lib/expected/matchers/extend_module.rb', line 20 def subject @subject end |
Instance Method Details
#description ⇒ String
48 49 50 |
# File 'lib/expected/matchers/extend_module.rb', line 48 def description "extend_module: <#{expected_module.inspect}>" end |
#failure_message ⇒ String
38 39 40 |
# File 'lib/expected/matchers/extend_module.rb', line 38 def "Expected #{expectation}" end |
#failure_message_when_negated ⇒ String
43 44 45 |
# File 'lib/expected/matchers/extend_module.rb', line 43 def "Did not expect #{expectation}" end |
#matches?(subject) ⇒ True, False
Run the test
31 32 33 34 35 |
# File 'lib/expected/matchers/extend_module.rb', line 31 def matches?(subject) self.subject = subject klass = self.subject.singleton_class klass.included_modules.include? expected_module end |