Sha256: e02b4254427a47b89cdb18467248e4239805c909e12ac22d26d86de5abd2e1b3

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

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

RSpec::Generator.debug = true

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|
      remove_migration :create_users
      g.run_generator [:create_users].args
      g.should generate_migration :create_users do |content|
        content.should have_migration :create_users 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
              user_tbl.should_not have_timestamps              
            end
          end

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



Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
generator-spec-0.4.7 spec/generator_spec/generators/migration_generator_spec.rb
generator-spec-0.4.5 spec/generator_spec/migration_generator_spec.rb
generator-spec-0.4.4 spec/generator_spec/migration_generator_spec.rb
generator-spec-0.4.3 spec/rspec_for_generators/migration_generator_spec.rb