-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add test coverage for rich_text_area
helper
#50255
Add test coverage for rich_text_area
helper
#50255
Conversation
bb564eb
to
e87066e
Compare
output_buffer | ||
end | ||
|
||
test "#rich_text_area helper renders the value: argument into the hidden field" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to not combine this test with the "#rich_text_area helper"
test?
Also, if we're keeping this test separate, I think the convention is to write the symbol form of option names:
test "#rich_text_area helper renders the value: argument into the hidden field" do | |
test "#rich_text_area helper renders the :value option into the hidden field" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathanhefner I kept them separate because I wanted to explicitly test the method signature. With rich_text_area_tag
, the value is a positional argument. With rich_text_area
, the value is derived from options[:value]
. That different felt significant enough to cover separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are saying you want to keep this test separate from "#rich_text_area_tag helper"
, which I agree with. But I was asking why not combine this test and "#rich_text_area helper"
?
Or am I misunderstanding what you wrote?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry for being unclear. To complete the thought I state above, I think it's important to include a #rich_text_area
test that omits the value and passes an HTML input
option _so that there's coverage that the Hash
isn't treated as a value
positional argument.
Similarly, having the second test for explicit treatment of the value
option feels similarly valuable to keep.
Does that clarify my original comment?
e87066e
to
917b4bb
Compare
917b4bb
to
d1fb0b8
Compare
Follow-up to [rails#50252][] Similar to the reliance on a `FormBuilder` in the helper methods documentation examples, the template test coverage for `#rich_text_area` relied on invocations through a `FormBuilder` instance. This commit adds explicit coverage for calling the `#rich_text_area` helper method directly with both an `object_name` and `method_name` positional arguments. [rails#50252]: rails#50252
d1fb0b8
to
16c28d0
Compare
Thank you, @seanpdoyle! 🧪 |
Motivation / Background
Follow-up to #50252
Similar to the reliance on a
FormBuilder
in the helper methods documentation examples, the template test coverage for#rich_text_area
relied on invocations through aFormBuilder
instance.Detail
This commit adds explicit coverage for calling the
#rich_text_area
helper method directly with both anobject_name
andmethod_name
positional arguments.Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]