class RSpec::Rails::Matchers::ActionCable::HaveStream
Not intended to be instantiated directly.
Provides the implementation for ‘have_stream`, `have_stream_for`, and `have_stream_from`.
@api private
def base_message
def base_message no_expected? ? "any stream started" : "stream #{expected_formatted} started, but have #{actual_formatted}" end
def does_not_match?(subscription)
-
(Boolean)
-
Other tags:
- Api: - private
def does_not_match?(subscription) !match(subscription) end
def failure_message
-
(String)
-
Other tags:
- Api: - private
def failure_message "expected to have #{base_message}" end
def failure_message_when_negated
-
(String)
-
Other tags:
- Api: - private
def failure_message_when_negated "expected not to have #{base_message}" end
def match(subscription)
def match(subscription) case subscription when ::ActionCable::Channel::Base @actual = subscription.streams no_expected? ? actual.any? : actual.any? { |i| expected === i } else raise ArgumentError, "have_stream, have_stream_from and have_stream_from support expectations on subscription only" end end
def matches?(subscription)
-
(Boolean)
-
Other tags:
- Api: - private
def matches?(subscription) raise(ArgumentError, "have_streams is used for negated expectations only") if no_expected? match(subscription) end
def no_expected?
def no_expected? !defined?(@expected) end