Permalink
Browse files

Merge pull request #11163 from nfedyashev/omit_turbolinks_on_javascri…

…pt_skip_option

Omit turbolinks configuration completely on skip_javascript generator option
  • Loading branch information...
2 parents 8f63515 + e68183c commit 6b745ec9ee691b803cb701b1efa4e463d90ee01f @carlosantoniodasilva carlosantoniodasilva committed Jun 28, 2013
@@ -1,3 +1,7 @@
+* Omit turbolinks configuration completely on skip_javascript generator option.
+
+ *Nikita Fedyashev*
+
* Removed deprecated rake tasks for running tests: `rake test:uncommitted` and
`rake test:recent`.
@@ -2,8 +2,13 @@
<html>
<head>
<title><%= camelized %></title>
+ <%- if options[:skip_javascript] -%>
+ <%%= stylesheet_link_tag "application", media: "all" %>
+ <%%= javascript_include_tag "application" %>
+ <%- else -%>
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
+ <%- end -%>
<%%= csrf_meta_tags %>
</head>
<body>
@@ -53,9 +53,10 @@ def default_files
def test_assets
run_generator
- assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application"/
- assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/
- assert_file "app/assets/stylesheets/application.css"
+
+ assert_file("app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application", media: "all", "data-turbolinks-track" => true/)
+ assert_file("app/views/layouts/application.html.erb", /javascript_include_tag\s+"application", "data-turbolinks-track" => true/)
+ assert_file("app/assets/stylesheets/application.css")
end
def test_invalid_application_name_raises_an_error
@@ -295,6 +296,10 @@ def test_javascript_is_skipped_if_required
assert_file "app/assets/javascripts/application.js" do |contents|
assert_no_match %r{^//=\s+require\s}, contents
end
+ assert_file "app/views/layouts/application.html.erb" do |contents|
+ assert_match(/stylesheet_link_tag\s+"application", media: "all" %>/, contents)
+ assert_match(/javascript_include_tag\s+"application" \%>/, contents)
+ end
assert_file "Gemfile" do |content|
assert_match(/coffee-rails/, content)
end

0 comments on commit 6b745ec

Please sign in to comment.