class Expected::Matchers::IncludeModuleMatcher
Class used by {#include_module}
Attributes
expected_module[R]
subject[R]
Public Class Methods
new(expected_module)
click to toggle source
@param expected_module
[Module] The module the {#subject} is expected to include
# File lib/expected/matchers/include_module.rb, line 23 def initialize(expected_module) @expected_module = expected_module end
Public Instance Methods
description()
click to toggle source
@return [String]
# File lib/expected/matchers/include_module.rb, line 47 def description "include_module: <#{expected_module.inspect}>" end
failure_message()
click to toggle source
@return [String]
# File lib/expected/matchers/include_module.rb, line 37 def failure_message "Expected #{expectation}" end
failure_message_when_negated()
click to toggle source
@return [String]
# File lib/expected/matchers/include_module.rb, line 42 def failure_message_when_negated "Did not expect #{expectation}" end
matches?(subject)
click to toggle source
Run the test @param subject The thing to test against @return [True] If the test passes @return [False] if the test fails
# File lib/expected/matchers/include_module.rb, line 31 def matches?(subject) self.subject = subject self.subject.included_modules.include? expected_module end
Private Instance Methods
expectation()
click to toggle source
@return String
# File lib/expected/matchers/include_module.rb, line 60 def expectation "<#{subject.inspect}> to include <#{expected_module.inspect}>" end
subject=(subject)
click to toggle source
The thing to test against @return [Class, Module]
# File lib/expected/matchers/include_module.rb, line 55 def subject=(subject) @subject = subject.instance_of?(Class) || subject.is_a?(Module) ? subject : subject.class end