Class: Warp::ControllerMatchers::AssignWithMatcher

Inherits:
AssignMatcher show all
Defined in:
lib/warp/controller_matchers/assign_matcher.rb

Instance Attribute Summary collapse

Attributes inherited from AssignMatcher

#assign_key, #controller

Instance Method Summary collapse

Methods inherited from AssignMatcher

#matches?

Constructor Details

#initialize(controller, assign_key, assign_with) ⇒ AssignWithMatcher

Returns a new instance of AssignWithMatcher.



82
83
84
85
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 82

def initialize(controller, assign_key, assign_with)
  super(controller, assign_key)
  @assign_with = assign_with
end

Instance Attribute Details

#assign_withObject (readonly)

Returns the value of attribute assign_with.



80
81
82
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 80

def assign_with
  @assign_with
end

Instance Method Details

#descriptionObject



87
88
89
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 87

def description
  "assign @#{assign_key} with #{description_of(assign_with)}"
end

#failure_messageObject



91
92
93
94
95
96
97
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 91

def failure_message
  if assign_value.nil?
    "expected @#{assign_key} to be assigned with #{description_of(assign_with)} but was not assigned"
  else
    "expected @#{assign_key} to be assigned with #{description_of(assign_with)} but was assigned with #{assign_value.inspect}"
  end
end

#failure_message_when_negatedObject



99
100
101
# File 'lib/warp/controller_matchers/assign_matcher.rb', line 99

def failure_message_when_negated
  "expected @#{assign_key} to not be assigned with #{description_of(assign_with)}"
end