-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Honor public/private in ActionView::Helpers::Tags::Base#value #14180
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 |
---|---|---|
|
@@ -124,6 +124,12 @@ def test_tags_base_child_without_render_method | |
assert_raise(NotImplementedError) { FooTag.new.render } | ||
end | ||
|
||
def test_tags_base_value_honors_public_private | ||
test_object = Class.new { private def my_method ; end }.new | ||
tag = ActionView::Helpers::Tags::Base.new 'test_object', :my_method, nil | ||
assert_raise(NoMethodError) { tag.send :value, test_object } | ||
end | ||
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'm not sure that using 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. yeah I am unsure about that as well. The However the downside is, that it will most likely be a much bigger/more complicated test set up. Dunno if it's worth the cost so didn't wanna start with it (as I was unsure if this change is even welcome). Happy to try out a more behavior driven approach for testing. 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. How about trying to render a text input? |
||
|
||
def test_label | ||
assert_dom_equal('<label for="post_title">Title</label>', label("post", "title")) | ||
assert_dom_equal( | ||
|
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.
Why the
send
here? Couldn't you just dotag.value(test_object)
?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.
value is a private method unfortunately... :-/ So using send to work around it...
edit: thanks for your quick feedback! =D