Sha256: a82c350f2b74d700a6c9003853424bfdf4a532d497ac0b9dc6f90a924649fa2d
Contents?: true
Size: 1.22 KB
Versions: 16
Compression:
Stored size: 1.22 KB
Contents
require 'test_helper' require_generator :data_mapper => ['migration'] class DataMapper::Generators::MigrationGeneratorTest < Rails::Generators::TestCase destination File.join(Rails.root) tests DataMapper::Generators::MigrationGenerator setup :prepare_destination setup :copy_routes test "invoke with name of migration" do name = 'account' run_generator %w{Account} migration_name = Dir[File.join(Rails.root, "db/migrate/*_#{name}.rb")].first if migration_name assert_file migration_name do |migration| assert_match /up do/, migration assert_match /down do/, migration end else fail "No migration generated for #{name}" end end test "invoke with name and attributes" do name = 'account' run_generator %w{Account name:string} migration_name = Dir[File.join(Rails.root, "db/migrate/*_#{name}.rb")].first if migration_name assert_file migration_name do |migration| assert_match /up do/, migration assert_match /down do/, migration assert_match /modify_table :#{name.tableize}/, migration end else fail "No migration generated for #{name}" end end end
Version data entries
16 entries across 16 versions & 1 rubygems