diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-28 19:46:34 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-28 19:46:34 +0200 |
commit | 9413dba432b11d86b80449ca7b959b32ecb0844c (patch) | |
tree | 13eab65aefcc7cc4550f70a29da32b560b358641 /railties/test/generators/migration_generator_test.rb | |
parent | 9068bc05b8c5a1f2a0ad6959cb897d5831046d0a (diff) | |
download | rails-9413dba432b11d86b80449ca7b959b32ecb0844c.tar.gz rails-9413dba432b11d86b80449ca7b959b32ecb0844c.tar.bz2 rails-9413dba432b11d86b80449ca7b959b32ecb0844c.zip |
Added tessts for resources generator.
Diffstat (limited to 'railties/test/generators/migration_generator_test.rb')
-rw-r--r-- | railties/test/generators/migration_generator_test.rb | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index 90bc91344f..547ca6a9e3 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -20,32 +20,34 @@ class MigrationGeneratorTest < GeneratorsTestCase def test_add_migration_with_attributes @migration = "add_title_body_to_posts" run_generator [@migration, "title:string", "body:text"] - content = assert_migration "db/migrate/#{@migration}.rb" - assert_class_method_for content, :up do |up| - assert_match /add_column :posts, :title, :string/, up - assert_match /add_column :posts, :body, :text/, up - end + assert_migration "db/migrate/#{@migration}.rb" do |content| + assert_class_method content, :up do |up| + assert_match /add_column :posts, :title, :string/, up + assert_match /add_column :posts, :body, :text/, up + end - assert_class_method_for content, :down do |down| - assert_match /remove_column :posts, :title/, down - assert_match /remove_column :posts, :body/, down + assert_class_method content, :down do |down| + assert_match /remove_column :posts, :title/, down + assert_match /remove_column :posts, :body/, down + end end end def test_remove_migration_with_attributes @migration = "remove_title_body_from_posts" run_generator [@migration, "title:string", "body:text"] - content = assert_migration "db/migrate/#{@migration}.rb" - assert_class_method_for content, :up do |up| - assert_match /remove_column :posts, :title/, up - assert_match /remove_column :posts, :body/, up - end + assert_migration "db/migrate/#{@migration}.rb" do |content| + assert_class_method content, :up do |up| + assert_match /remove_column :posts, :title/, up + assert_match /remove_column :posts, :body/, up + end - assert_class_method_for content, :down do |down| - assert_match /add_column :posts, :title, :string/, down - assert_match /add_column :posts, :body, :text/, down + assert_class_method content, :down do |down| + assert_match /add_column :posts, :title, :string/, down + assert_match /add_column :posts, :body, :text/, down + end end end |