Sha256: 24d3f2fe3401297e85e43036ae0f9cf5792239f3bb59763449f7dba4ac243165

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

require 'spec_helper'
require 'napa/generators/migration_generator'
require 'napa/cli'

describe Napa::Generators::MigrationGenerator do

  let(:migration_name) { 'foo_bars' }
  let(:test_migrations_directory) { 'spec/tmp' }

  before do
    described_class.any_instance.stub(:output_directory) { test_migrations_directory }
  end

  after do
    FileUtils.rm_rf(test_migrations_directory)
  end

  it 'creates a camelized migration class' do
    described_class.any_instance.stub(:migration_filename) { 'foo' }
    Napa::CLI::Base.new.generate("migration", migration_name)
    expected_migration_file = File.join(test_migrations_directory, 'foo.rb')
    migration_code = File.read(expected_migration_file)
    expect(migration_code).to match(/class FooBars/)
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
napa-0.3.0 spec/generators/migration_generator_spec.rb