spec/lib/localtower/generators/migration_spec.rb in localtower-0.1.3 vs spec/lib/localtower/generators/migration_spec.rb in localtower-0.1.4

- old
+ new

@@ -1,20 +1,12 @@ require 'spec_helper' module Localtower module Generators describe Migration do - - def migration_files - Dir["#{Rails.root}/db/migrate/*"] - end - - def last_migration - migration_files.sort.last - end - before(:all) do + clean_files end after(:all) do end @@ -23,9 +15,18 @@ data["run_migrate"] = true generator = ::Localtower::Generators::Migration.new(data).run expect(::Localtower::Tools.word_in_file?(last_migration, /create_table :posts/)).to eq(true) + end + + it 'create_table_two' do + data = attributes_for(:create_table_two) + data["run_migrate"] = true + + generator = ::Localtower::Generators::Migration.new(data).run + + expect(::Localtower::Tools.word_in_file?(last_migration, /create_table :users/)).to eq(true) end it 'add_column' do data = attributes_for(:add_column) data["run_migrate"] = true