1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

application template respects Gemfile entries

This commit is contained in:
Aaron Patterson 2013-11-04 15:00:19 -08:00
parent 8beb42cfbc
commit 7eb586f57f
2 changed files with 25 additions and 0 deletions

View file

@ -5,8 +5,13 @@
<%- if options[:skip_javascript] -%>
<%%= stylesheet_link_tag "application", media: "all" %>
<%- else -%>
<%- if gemfile_entries.any? { |m| m.name == "turbolinks" } -%>
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%- else -%>
<%%= stylesheet_link_tag "application", media: "all" %>
<%%= javascript_include_tag "application" %>
<%- end -%>
<%- end -%>
<%%= csrf_meta_tags %>
</head>

View file

@ -182,6 +182,26 @@ class AppGeneratorTest < Rails::Generators::TestCase
template.unlink
end
def test_application_html_checks_gems
template = Tempfile.open 'my_template'
template.puts 'add_gem_entry_filter { |gem| gem.name != "turbolinks" }'
template.flush
run_generator([destination_root, "-m", template.path])
assert_file "Gemfile" do |contents|
assert_no_match 'turbolinks', contents
end
assert_file "Gemfile" do |contents|
assert_no_match 'turbolinks', contents
end
assert_file "app/views/layouts/application.html.erb" do |contents|
assert_no_match 'turbolinks', contents
end
ensure
template.close
template.unlink
end
def test_config_another_database
run_generator([destination_root, "-d", "mysql"])
assert_file "config/database.yml", /mysql/