-
Notifications
You must be signed in to change notification settings - Fork 16
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 case for issue #24 #37
Conversation
First off: thank you for being awesome and figuring out how to contribute a test in the absence of docs. I really appreciate it! Complete coincidence — I was just looking at this in the last couple of days. (I have a test case that looks extremely similar to this.) I have the same problem: I'm unable to reproduce the issue. It looks like it “all works”. If anybody can figure out how to reproduce the issue, please let me know. I absolutely will fix it if I can reproduce it…but I just can’t seem to make it happen right now, no matter what I do. I’m still thinking deeply about the I’m thinking of first making My goal here is that when people want to use something like |
With regard to figuring out how to write a test: my pleasure! I've also pinged Karl and Harlan in #24, so hopefully they can chime in and we can figure out if there's actually a bug here. I know that there's a reason I used the monkeypatch originally... but it might have had to do with simple_form. Anyway, I've been thinking about some of the same stuff -- I was going to ask you about your preferred pattern for creating a compatibility gem like I agree that the |
Memory isn't too good on this one, I'll try and see if I can reproduce it again. In the meantime, I did notice that in my code the only time this situation pops up is with a hash argument, e.g. |
Weird, so the build failed on CI. |
So I finally got my environment working (turns out it's because I didn't have nodejs installed...), and your test does fail for me, here's a snippet:
Which I think is exactly what we would expect? If it helps, I set up a Vagrant box with the following config to test it:
|
It looks like the failures are conditional on the version of Rails. I can give this another shot when I get a chance... |
Finally getting back to this. Notes to myself: The problem is triggered by code like this: form_for :person do |f|
f.label(:name) do
text 'Foo'
end
end When Fortitude sees the call to The issue is the inner block. There is a bug in Fortitude without this patch that causes it to fail when trying to wrap the inner block — it’s expecting blocks to always have at least one argument, and that fails, which this PR fixes. But the much more important bug is deeper: when we call that inner block, What needs to happen is that the inner call to |
So, after further digging — there were two issues here:
<%= form_for :person do |f| %>
<%= f.label :name do %>
Foo
<% end %>
<% end %> …ends up emitting something like this: <form accept-charset="UTF-8" action="/foo/bar" method="post">
Foo
<label for="person_name">
Foo
</label></form> …which is clearly wrong. Yes, this is wrong in a different way than Fortitude’s output is wrong, and that might make me suspect Fortitude. But (a) Fortitude isn’t doing anything particularly weird under the covers here, and (b) both Fortitude and ERb are broken on Rails 3.0/3.1, while (c) both Fortitude and ERb work perfectly on Rails 3.2 and above. As such, I don’t think there’s anything to fix in Fortitude here. I’ve added this example to the spec suite, with a The fix for the first issue outlined here is in 0.9.5, which I just released. |
This is a test case for #24, but the tests are passing where they should be failing.