class Line::Message::RSpec::Matchers::HaveFlexComponent
The flex component matcher for RSpec to search nested flex components in the message array.
Public Class Methods
Source
# File lib/line/message/rspec/matchers/have_flex_component.rb, line 10 def initialize(expected_desc: nil, &expected) @expected = expected @expected_desc = expected_desc end
Public Instance Methods
Source
# File lib/line/message/rspec/matchers/have_flex_component.rb, line 15 def description return "have flex component" if @expected.nil? return "have flex component matching #{@expected_desc}" if @expected_desc "have flex component matching #{@expected.inspect}" end
Source
# File lib/line/message/rspec/matchers/have_flex_component.rb, line 28 def failure_message return "expected to find a flex component" if @expected.nil? return "expected to find a flex component matching #{@expected_desc}" if @expected_desc "expected to find a flex component matching #{@expected.inspect}" end
Source
# File lib/line/message/rspec/matchers/have_flex_component.rb, line 22 def matches?(actual) @actual = Utils.stringify_keys!(actual, deep: true) @actual.any? { |message| match_flex_component?(message) } end
Also aliased as: ==