Sha256: f8f72218626a63730352be9cbfbd3ea6686c9c0a535ae6210724411baeaf7bb5

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require_generator :migration

describe 'migration_generator' do
  include RSpec::Rails::Orm::ActiveRecord
  include RSpec::Rails::Migration
  
  before :each do              
    setup_generator 'migration_generator' do
      tests MigrationGenerator
    end    
  end

  after :each do
  end
    
  it "should generate create_user migration" do    
    with_generator do |g|
      name = 'create_users'
      remove_migration 'create_users'
      g.run_generator [name]
      g.should generate_migration name do |content|
        content.should have_migration name do |klass|
          klass.should have_up do |up|
            up.should have_create_table :users do |user_tbl|
              user_tbl.should have_columns :name => :string, :age => :string
            end
          end

          klass.should have_down do |up|
            up.should have_drop_table :users
          end
        end
      end
    end
  end
end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generator-spec-0.4.0 spec/rspec_for_generators/migration_generator_spec.rb