-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Sprockets to use config.assets.prefix, with tests #3092
Conversation
I think just one test like ...
is enough. |
assert_match %r{<link href="/s/style-[0-9a-f]+.css\?body=1" media="print" rel="stylesheet" type="text/css" />\n<link href="/s/application-[0-9a-f]+.css\?body=1" media="print" rel="stylesheet" type="text/css" />}, | ||
stylesheet_link_tag(:application, :media => "print") | ||
end | ||
|
||
test "alternate asset prefix" 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.
I am not familiar with the difference between stubs(:asset_prefix).returns("/themes/test") and @config.assets.prefix = '/s'. They appear to be the same, however it is not clear why the former apparently worked prior to this commit.
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.
stubs method generate a stub for asset_prefix method, so when you invoke this method will always return "/themes/test". Using @config.assets.prefix = '/s' you're just configuring the prefix and using it you're testing properly without stubs, so go with @config.assets.prefix = '/s'
Great! I will simplify the test later today and recommit. |
Remember to squash all the commits into one and push -f to your master branch |
OK, that is done. Let me know if anything further is required, and thank you for the collaboration. |
Do I need to close the pull request to indicate that its ready to go, or does that cancel the request? |
Sprockets to use config.assets.prefix, with tests
Sprockets to use config.assets.prefix, with tests
A simple change to actionpack/lib/sprockets/helpers/rails_helpers.rb, based off this previous commit:
2684f17
which I found when encountering this problem:
http://www.ruby.code-experiments.com/blog/2011/09/a-problem-with-the-rails-31-asset-pipeline.html
I would appreciate feedback on the tests, specifically the "alternate asset prefix" test on line 345 of the updated sprockets_helper_test.rb.
Albert