test/generator_test.rb in attachs-0.4.5 vs test/generator_test.rb in attachs-4.0.0.0
- old
+ new
@@ -1,18 +1,26 @@
require 'test_helper'
require 'rails/generators'
-require 'generators/attachs/install_generator'
+require 'generators/attachs/install/install_generator'
+require 'generators/attachs/upload/upload_generator'
-class GeneratorsTest < Rails::Generators::TestCase
- tests Attachs::InstallGenerator
- destination File.expand_path('../tmp', File.dirname(__FILE__))
+class GeneratorTest < Rails::Generators::TestCase
+ destination Rails.root.join('tmp')
teardown do
- FileUtils.rm_rf self.destination_root
+ FileUtils.rm_rf destination_root
end
- test 'initializer generator' do
+ test 'install' do
+ self.class.tests Attachs::Generators::InstallGenerator
run_generator
assert_file 'config/initializers/attachs.rb'
+ end
+
+ test 'upload' do
+ self.class.tests Attachs::Generators::UploadGenerator
+ run_generator
+ assert_file 'app/models/upload.rb'
+ assert_migration 'db/migrate/create_uploads.rb'
end
end