class ClassAction::RSpec::RespondWithMatcher
Public Class Methods
new(expected)
click to toggle source
# File lib/class_action/rspec/respond_with_matcher.rb, line 6 def initialize(expected) @expected = expected.to_sym end
Public Instance Methods
description()
click to toggle source
# File lib/class_action/rspec/respond_with_matcher.rb, line 21 def description if @condition "respond with method :#{@expected} on :#{@condition}" else "respond with method :#{@expected}" end end
failure_message()
click to toggle source
# File lib/class_action/rspec/respond_with_matcher.rb, line 29 def failure_message suffix = if @actual ", but it responds with :#{@actual}" else ", but it has no response method" end if @condition "expected action of class #{@action.class} to respond with :#{@expected} on :#{@condition}#{suffix}" else "expected action of class #{@action.class} to respond with :#{@expected}#{suffix}" end end
failure_message_when_negated()
click to toggle source
# File lib/class_action/rspec/respond_with_matcher.rb, line 43 def failure_message_when_negated if @condition "expected action of class #{@action.class} not to respond with :#{@expected} on :#{@condition}" else "expected action of class #{@action.class} not to respond with :#{@expected}" end end
matches?(action)
click to toggle source
# File lib/class_action/rspec/respond_with_matcher.rb, line 15 def matches?(action) @action = action @actual = action.class._responses[@condition].try(:to_sym) @actual == @expected end
on(condition)
click to toggle source
# File lib/class_action/rspec/respond_with_matcher.rb, line 10 def on(condition) @condition = condition self end