Sha256: caa8cb1fe06f031b83ced10d16e2a70762a0bd5ffda1b2638dbf5561a9701042

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

require "rails/version"
require "rspec/rails"
require "ammeter/init"

TMP_GENERATOR_PATH = File.expand_path('../generator-tmp', __FILE__)

shared_examples 'a generator' do
  destination TMP_GENERATOR_PATH
  before { prepare_destination }
  let(:gen) { generator %w[Yummy::Bacon Yummy::BaconTransition] }

  it 'invokes create_model_file method' do
    expect(gen).to receive(:create_model_file)
    gen.invoke_all
  end

  describe 'it runs the generator and check things out' do
    before { run_generator %w[Yummy::Bacon Yummy::BaconTransition] }

    describe 'it generates a correctly named file' do
      subject { file(migration_name) }
      it { is_expected.to be_a_migration }
    end
  end
end

RSpec.configure do |config|
  config.after :all do
    FileUtils.rm_rf(TMP_GENERATOR_PATH)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
statesman-3.2.0 spec/support/generators_shared_examples.rb
statesman-3.1.0 spec/support/generators_shared_examples.rb