-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Missing partial in view specs with template inheritance #5213
Comments
Is this still an issue? |
Most likely. |
Repro steps? |
rspec/rspec-rails#396 (comment) P.S. Before commenting with "is this still an issue?" or "Repro steps?", please take the time and thoroughly go through the bug report. There is more than enough information in this particular issue for you to proceed. It is very annoying and disrespectful to the people involved that take the time to submit well documented issues. Thanks. |
I am sorry. My intention is to bump as many issues as I can. There are hundreds of issues. Some are solved and no one realizes. It is by removing the noise that we can focus on the real ones. I apologize for not reading the issue more. I will take a look later. Thank you for your involvement, and I hope that you can forgive me. On May 6, 2012, at 6:45 PM, Justin Koreply@reply.github.com wrote:
|
No harm done! I did the same thing when I was given access to RSpec :)
I think Rails core needs more members. Or at least a dedicated "issues" team - kind of like how some devs focus on Rails documentation. A lot of the work with issues is the pain of reproducing, confirming whether it's a bug or not, etc. The issues team could attach failing tests to the issues to help out the "core" devs. |
Any thoughts on this @tenderlove? |
@justinko the Issues team already exists and I'm part of this team. Currently we are 7 people. |
Issue bump, 3 months old. At the risk of repeating the previous conversation has anyone had any luck looking into this issue? Are there any blockers or problems? Would you like me to look into a fix? |
If you can, please go ahead with a fix. |
I looked into this a good bit, and I believe the behavior seen testing views isolated from controllers should be expected. The mechanism that gives us the ability to put a view in a parent folder is directly due to inheritance on the controller level. Without the controller the view has no concept of inheritance, and therefore it would not know that
instead of
By explicitly declaring the path of the partial, you are also making your program more robust. That being said, if we want to "fix" this bug in this one specific case, we can have the default We could change this:
to this:
Though that only really "solves" this one particular case, and not the overall issue of testing views with partials without their controllers. Thoughts? |
Anyone involved have a comment or question? If not we should close this issue. |
Seems reasonable to me. Sounds like a close is in order, but I'd prefer to hear from someone closer to the issue before actually doing it. |
If it would help, I can submit a PR so the default |
I'm 👎 on the idea of making require 'test_helper'
# This tests that the PagesController#index template renders
# the partial in the ApplicationController view directory
class PagesIndexTest < ActionView::TestCase
test "pages/index renders application/header" do
view.lookup_context.prefixes = %w[pages application]
render :template => "pages/index"
assert_template :partial => "application/_header"
end
end The hardest part is coming up with the name for the helper - perhaps something like |
Seems this is not a bug but a feature request so I'm closing this issue. |
I'm sure how you figure this is a feature request? If the expected functionality is to be able to test views as if they running in a Rails app this a bug (albeit it with some additional functionality required to resolve). |
This still is a problem for me. I found a workaround, but it feels clumsy. Detailed explanation on StackOverflow: Rails view specs: referenced partials of inherited controllers aren't found |
I can't believe I spent a whole day trying to figure this out. |
There seems to be a problem when testing a view that renders a partial through template inheritance. The issue has come up and been discussed on the rspec-rails forum where I filed an issue here. However, it seems that it is an issue that should be fixed by rails as discussed in issue #396
The text was updated successfully, but these errors were encountered: