Class: Line::Message::RSpec::Matchers::HaveFlexBubble
- Inherits:
-
Object
- Object
- Line::Message::RSpec::Matchers::HaveFlexBubble
- Defined in:
- lib/line/message/rspec/matchers/have_flex_bubble.rb
Overview
The flex component matcher for RSpec to search nested flex components in the message array.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ HaveFlexBubble
constructor
A new instance of HaveFlexBubble.
- #matches?(actual) ⇒ Boolean (also: #==)
Constructor Details
#initialize(expected) ⇒ HaveFlexBubble
Returns a new instance of HaveFlexBubble.
10 11 12 |
# File 'lib/line/message/rspec/matchers/have_flex_bubble.rb', line 10 def initialize(expected) @expected = Utils.stringify_keys!(expected || {}, deep: true) end |
Instance Method Details
#description ⇒ Object
14 15 16 17 18 |
# File 'lib/line/message/rspec/matchers/have_flex_bubble.rb', line 14 def description return "have flex bubble" if @expected.empty? "have flex bubble matching #{@expected.inspect}" end |
#failure_message ⇒ Object
26 27 28 29 30 |
# File 'lib/line/message/rspec/matchers/have_flex_bubble.rb', line 26 def return "expected to find a flex bubble" if @expected.empty? "expected to find a flex bubble matching #{@expected.inspect}" end |
#matches?(actual) ⇒ Boolean Also known as: ==
20 21 22 23 |
# File 'lib/line/message/rspec/matchers/have_flex_bubble.rb', line 20 def matches?(actual) @actual = Utils.stringify_keys!(actual, deep: true) @actual.any? { || match_flex_component?() } end |