-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Rails 7.1 and 7.2. Experiment with Ruby 3.3.
- Loading branch information
1 parent
50a2438
commit 738b01b
Showing
5 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ version links. | |
|
||
## main | ||
|
||
Expand matrix of supported versions to include `[email protected]` and `[email protected]`. | ||
|
||
## [0.2.1] - Jan 22, 2023 | ||
|
||
Add test coverage for `field_id` and `field_name`, and delegate to view context | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require "test_helper" | ||
|
||
class ViewPartialFormBuilder::TemplateProxyTest < ActionView::TestCase | ||
test "#capture is delegated to the template" do | ||
render_with_template_proxy <<~ERB | ||
<% content = template_proxy.capture do %> | ||
Hello world | ||
<% end %> | ||
<%= content %> | ||
ERB | ||
|
||
assert_equal rendered.strip, "Hello world" | ||
end | ||
|
||
test "#field_id is delegated to the template" do | ||
render_with_template_proxy <<~ERB | ||
<%= template_proxy.field_id(:object_name, :method_name) %> | ||
ERB | ||
|
||
assert_equal rendered.strip, "object_name_method_name" | ||
end | ||
|
||
test "#field_name is delegated to the template" do | ||
render_with_template_proxy <<~ERB | ||
<%= template_proxy.field_name(:object_name, :method_name) %> | ||
ERB | ||
|
||
assert_equal rendered.strip, "object_name[method_name]" | ||
end | ||
|
||
def render_with_template_proxy(template) | ||
render inline: <<~ERB, locals: {template: template} | ||
<% template_proxy = ViewPartialFormBuilder::TemplateProxy.new(builder: nil, template: self) %> | ||
<%= render inline: template, locals: {template_proxy: template_proxy} %> | ||
ERB | ||
end | ||
end |