class Expected::Matchers::BeAConcernMatcher

Class used by {#be_a_concern}

Attributes

extend_module_matcher[R]
subject[R]

Public Class Methods

new() click to toggle source
# File lib/expected/matchers/be_a_concern.rb, line 23
def initialize
  @extend_module_matcher = ExtendModuleMatcher.new(ActiveSupport::Concern)
end

Public Instance Methods

description() click to toggle source

@return [String]

# File lib/expected/matchers/be_a_concern.rb, line 47
def description
  'be_a_concern'
end
failure_message() click to toggle source

@return [String]

# File lib/expected/matchers/be_a_concern.rb, line 37
def failure_message
  "Expected #{expectation}"
end
failure_message_when_negated() click to toggle source

@return [String]

# File lib/expected/matchers/be_a_concern.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/be_a_concern.rb, line 31
def matches?(subject)
  self.subject = subject
  @extend_module_matcher.matches?(subject)
end

Private Instance Methods

expectation() click to toggle source

@return String

# File lib/expected/matchers/be_a_concern.rb, line 63
def expectation
  "<#{subject.inspect}> to be an ActiveSupport::Concern"
end
subject=(subject) click to toggle source

The thing to test against @return [Module]

# File lib/expected/matchers/be_a_concern.rb, line 55
def subject=(subject)
  unless subject.instance_of?(Module)
    raise "The subject for BeAConcernMatcher must be a Module, but was: `#{subject.inspect}`"
  end
  @subject = subject
end