Skip to content

Commit

Permalink
Add a default yield :head to layouts/application.html.erb (#50527)
Browse files Browse the repository at this point in the history
* Add a default yield :head

Good pattern that most applications should be using.

* Make test more resilient

* Appease RuboCop
  • Loading branch information
dhh committed Jan 2, 2024
1 parent ad2354e commit c57b2cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
<%%= csrf_meta_tags %>
<%%= csp_meta_tag %>

<%%= yield :head %>
<%- if options[:skip_hotwire] || options[:skip_javascript] -%>

<%%= stylesheet_link_tag "application" %>
<%- else -%>

<%%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%- end -%>
</head>
Expand Down
3 changes: 1 addition & 2 deletions railties/test/application/rake_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ class Hello
end

def test_code_statistics
assert_match "Code LOC: 63 Test LOC: 5 Code to Test Ratio: 1:0.1",
rails("stats")
assert_match(/Code LOC: \d+\s+Test LOC: \d+\s+ Code to Test Ratio: 1:\w+/, rails("stats"))
end

def test_loading_specific_fixtures
Expand Down

0 comments on commit c57b2cd

Please sign in to comment.