Skip to content

Commit

Permalink
Omit turbolinks configuration completely on skip_javascript generator…
Browse files Browse the repository at this point in the history
… option
  • Loading branch information
nfedyashev committed Jun 28, 2013
1 parent 569227b commit e68183c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions railties/CHANGELOG.md
@@ -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 * Removed deprecated rake tasks for running tests: `rake test:uncommitted` and
`rake test:recent`. `rake test:recent`.


Expand Down
Expand Up @@ -2,8 +2,13 @@
<html> <html>
<head> <head>
<title><%= camelized %></title> <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 %> <%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%- end -%>
<%%= csrf_meta_tags %> <%%= csrf_meta_tags %>
</head> </head>
<body> <body>
Expand Down
11 changes: 8 additions & 3 deletions railties/test/generators/app_generator_test.rb
Expand Up @@ -53,9 +53,10 @@ def default_files


def test_assets def test_assets
run_generator 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/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application", media: "all", "data-turbolinks-track" => true/)
assert_file "app/assets/stylesheets/application.css" 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 end


def test_invalid_application_name_raises_an_error def test_invalid_application_name_raises_an_error
Expand Down Expand Up @@ -295,6 +296,10 @@ def test_javascript_is_skipped_if_required
assert_file "app/assets/javascripts/application.js" do |contents| assert_file "app/assets/javascripts/application.js" do |contents|
assert_no_match %r{^//=\s+require\s}, contents assert_no_match %r{^//=\s+require\s}, contents
end 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_file "Gemfile" do |content|
assert_match(/coffee-rails/, content) assert_match(/coffee-rails/, content)
end end
Expand Down

0 comments on commit e68183c

Please sign in to comment.