mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add a template per case on asset debugging tests
It avoids the problem when the file checker is not able to detect changes on the files during testing.
This commit is contained in:
parent
a8c4c27a81
commit
0063fb307a
1 changed files with 34 additions and 17 deletions
|
@ -85,14 +85,18 @@ module ApplicationTests
|
|||
image_submit_tag: %r{<input type="image" src="/images/#{contents}" />}
|
||||
}
|
||||
|
||||
class ::PostsController < ActionController::Base
|
||||
def index
|
||||
render params[:view_method]
|
||||
end
|
||||
end
|
||||
|
||||
cases.each do |(view_method, tag_match)|
|
||||
app_file "app/views/posts/index.html.erb", "<%= #{view_method} '#{contents}', skip_pipeline: true %>"
|
||||
app_file "app/views/posts/#{view_method}.html.erb", "<%= #{view_method} '#{contents}', skip_pipeline: true %>"
|
||||
|
||||
app "development"
|
||||
|
||||
class ::PostsController < ActionController::Base ; end
|
||||
|
||||
get "/posts?debug_assets=true"
|
||||
get "/posts?debug_assets=true&view_method=#{view_method}"
|
||||
|
||||
body = last_response.body
|
||||
assert_match(tag_match, body, "Expected `#{view_method}` to produce a match to #{tag_match}, but did not: #{body}")
|
||||
|
@ -111,14 +115,18 @@ module ApplicationTests
|
|||
stylesheet_url: %r{http://example.org/stylesheets/#{contents}},
|
||||
}
|
||||
|
||||
class ::PostsController < ActionController::Base
|
||||
def index
|
||||
render params[:view_method]
|
||||
end
|
||||
end
|
||||
|
||||
cases.each do |(view_method, tag_match)|
|
||||
app_file "app/views/posts/index.html.erb", "<%= #{view_method} '#{contents}', skip_pipeline: true %>"
|
||||
app_file "app/views/posts/#{view_method}.html.erb", "<%= #{view_method} '#{contents}', skip_pipeline: true %> "
|
||||
|
||||
app "development"
|
||||
|
||||
class ::PostsController < ActionController::Base ; end
|
||||
|
||||
get "/posts?debug_assets=true"
|
||||
get "/posts?debug_assets=true&view_method=#{view_method}"
|
||||
|
||||
body = last_response.body
|
||||
assert_match(tag_match, body, "Expected `#{view_method}` to produce a match to #{tag_match}, but did not: #{body}")
|
||||
|
@ -130,14 +138,19 @@ module ApplicationTests
|
|||
/\/assets\/application-.*.\.js/ => {},
|
||||
/application.js/ => { skip_pipeline: true },
|
||||
}
|
||||
cases.each do |(tag_match, options_hash)|
|
||||
app_file "app/views/posts/index.html.erb", "<%= asset_path('application.js', #{options_hash}) %>"
|
||||
|
||||
class ::PostsController < ActionController::Base
|
||||
def index
|
||||
render params[:version]
|
||||
end
|
||||
end
|
||||
|
||||
cases.each_with_index do |(tag_match, options_hash), index|
|
||||
app_file "app/views/posts/version_#{index}.html.erb", "<%= asset_path('application.js', #{options_hash}) %>"
|
||||
|
||||
app "development"
|
||||
|
||||
class ::PostsController < ActionController::Base ; end
|
||||
|
||||
get "/posts?debug_assets=true"
|
||||
get "/posts?debug_assets=true&version=version_#{index}"
|
||||
|
||||
body = last_response.body.strip
|
||||
assert_match(tag_match, body, "Expected `asset_path` with `#{options_hash}` to produce a match to #{tag_match}, but did not: #{body}")
|
||||
|
@ -150,14 +163,18 @@ module ApplicationTests
|
|||
public_compute_asset_path: /application.js/,
|
||||
}
|
||||
|
||||
class ::PostsController < ActionController::Base
|
||||
def index
|
||||
render params[:view_method]
|
||||
end
|
||||
end
|
||||
|
||||
cases.each do |(view_method, tag_match)|
|
||||
app_file "app/views/posts/index.html.erb", "<%= #{ view_method } 'application.js' %>"
|
||||
app_file "app/views/posts/#{view_method}.html.erb", "<%= #{ view_method } 'application.js' %>"
|
||||
|
||||
app "development"
|
||||
|
||||
class ::PostsController < ActionController::Base ; end
|
||||
|
||||
get "/posts?debug_assets=true"
|
||||
get "/posts?debug_assets=true&view_method=#{view_method}"
|
||||
|
||||
body = last_response.body.strip
|
||||
assert_match(tag_match, body, "Expected `#{view_method}` to produce a match to #{ tag_match }, but did not: #{ body }")
|
||||
|
|
Loading…
Reference in a new issue