Permalink
Browse files

Generating assets on install

  • Loading branch information...
1 parent d747918 commit 62517a789d7d914df28c47e051ca86a3683accce @sporkd sporkd committed Dec 11, 2011
Showing with 23 additions and 0 deletions.
  1. +4 −0 lib/generators/html5/install/install_generator.rb
  2. +19 −0 test/generators/install_generator_test.rb
@@ -21,6 +21,10 @@ def generate_layout
invoke "html5:layout", ["application"], { :minimal_partials => true }
end
+ def generate_assets
+ invoke "html5:assets", ["application"]
+ end
+
def show_readme
readme "README" if behavior == :invoke
end
@@ -20,4 +20,23 @@ class InstallGeneratorTest < Rails::Generators::TestCase
assert_no_file "app/views/layouts/application.html.erb"
assert_file "app/views/layouts/application.html.haml"
end
+
+ test "minimal application partials should be generated" do
+ run_generator
+ %w(_footer _head _header).each do |file|
+ assert_file "app/views/application/#{ file }.html.haml"
+ end
+ %w(_flashes _javascripts _stylesheets).each do |file|
+ assert_no_file "app/views/application/#{ file }.html.haml"
+ end
+ end
+
+ test "assets should be generated" do
+ run_generator
+ assert_file "app/assets/stylesheets/_defaults.css.scss"
+ assert_file "app/assets/stylesheets/application.css.scss", /@import "application\/document";/
+ %w(_defaults document media_queries).each do |file|
+ assert_file "app/assets/stylesheets/application/#{ file }.css.scss"
+ end
+ end
end

0 comments on commit 62517a7

Please sign in to comment.