From 43215de208a6feabdbc5f4ec29551beef4f89885 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 13 Oct 2010 23:01:46 +0300 Subject: Add task foo:install (where foo is plugin) as a shortcutinstall:migrations and foo:install:assets --- railties/test/railties/shared_tests.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'railties/test') diff --git a/railties/test/railties/shared_tests.rb b/railties/test/railties/shared_tests.rb index d81155e8af..31ba2eaca2 100644 --- a/railties/test/railties/shared_tests.rb +++ b/railties/test/railties/shared_tests.rb @@ -10,6 +10,28 @@ module RailtiesTest @app ||= Rails.application end + def test_install_migrations_and_assets + @plugin.write "public/javascripts/foo.js", "doSomething()" + + @plugin.write "db/migrate/1_create_users.rb", <<-RUBY + class CreateUsers < ActiveRecord::Migration + end + RUBY + + app_file "db/migrate/1_create_sessions.rb", <<-RUBY + class CreateSessions < ActiveRecord::Migration + end + RUBY + + add_to_config "ActiveRecord::Base.timestamped_migrations = false" + + Dir.chdir(app_path) do + `rake bukkits:install` + assert File.exists?("#{app_path}/db/migrate/2_create_users.rb") + assert File.exists?(app_path("public/bukkits/javascripts/foo.js")) + end + end + def test_copying_assets @plugin.write "public/javascripts/foo.js", "doSomething()" @plugin.write "public/stylesheets/foo.css", "h1 { font-size: 10000px }" @@ -19,7 +41,9 @@ module RailtiesTest `rake bukkits:install:assets --trace` assert File.exists?(app_path("public/bukkits/javascripts/foo.js")) + assert_equal "doSomething()\n", File.read(app_path("public/bukkits/javascripts/foo.js")) assert File.exists?(app_path("public/bukkits/stylesheets/foo.css")) + assert_equal "h1 { font-size: 10000px }\n", File.read(app_path("public/bukkits/stylesheets/foo.css")) assert File.exists?(app_path("public/bukkits/images/img.png")) end end -- cgit v1.2.3