Sha256: 7a24e2695fe4a76d7184713ff39fda95b8720aa1f2842eece203da29de876b28

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

module Enginery
  module Test
    ORMs.each do |orm|
      Spec.new orm + 'Migrator' do
        
        Dir.chdir DST_ROOT do
          Testing do

            is(new_app "App o:#{orm}").ok?

            Dir.chdir 'App' do

              Context 'creating model' do
                is(new_model 'A column:name').ok?

                Context 'adding new column' do
                  is(new_migration 'addAboutColumn model:A column:about:text').ok?

                  Context 'running "up" auto-generated migration' do
                    is(migrate_up! 1).ok?

                    Context 'running "up" manually added migration' do
                      is(migrate_up! 2).ok?

                      Ensure 'all columns are in place' do
                        table = table('as')
                        check(table).has_column('name',  :string)
                        check(table).has_column('about', :text)

                        Context 'running "down" manual migration' do
                          Should 'drop "about" column' do
                            is(migrate_down! 2).ok?
                            check(table 'as').has_no_column 'about'
                          end
                        end

                        Context 'running "down" auto-migration' do
                          Should 'drop model table' do
                            is(migrate_down! 1).ok?
                            expect { table 'as' }.to_raise_error Mysql::Error
                          end
                        end

                      end
                    end
                  end
                end
              end

            end

          end
          cleanup
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
my_enginery-0.2.8 test/migrator/test__manual_generation.rb
enginery-0.3.0 test/migrator/test__manual_generation.rb