-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Improve implicit description for RSpec::Rails::Matchers::ActionCable::HaveBroadcastedTo #2795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,10 @@ def thrice | |
exactly(:thrice) | ||
end | ||
|
||
def description | ||
"have broadcasted #{base_description}" | ||
end | ||
|
||
def failure_message | ||
"expected to broadcast #{base_message}".tap do |msg| | ||
if @unmatching_msgs.any? | ||
|
@@ -140,18 +144,21 @@ def set_expected_number(relativity, count) | |
end | ||
end | ||
|
||
def base_message | ||
def base_description | ||
"#{message_expectation_modifier} #{@expected_number} messages to #{stream}".tap do |msg| | ||
msg << " with #{data_description(@data)}" unless @data.nil? | ||
msg << ", but broadcast #{@matching_msgs_count}" | ||
end | ||
end | ||
|
||
def base_message | ||
"#{base_description}, but broadcast #{@matching_msgs_count}" | ||
end | ||
|
||
def data_description(data) | ||
if data.is_a?(RSpec::Matchers::Composable) | ||
data.description | ||
else | ||
data | ||
data.inspect | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What did this actually come from, I'm on the fence wether letting user values user There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect a matcher to use this if mentioning an object. The default description for the it { expect("foo").to eq("foo") } Resultant description:
This adds some clarity to what the object is in context. |
||
end | ||
end | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.