Sha256: 6d03b2f51b10a8db2e294599eb1929b81e45cfd33ca7c5ed401598d7721061fa

Contents?: true

Size: 1.29 KB

Versions: 34

Compression:

Stored size: 1.29 KB

Contents

require 'generators/activity_notification/install_generator'

describe ActivityNotification::Generators::InstallGenerator, type: :generator do

  # setup_default_destination
  destination File.expand_path("../../../tmp", __FILE__)
  before { prepare_destination }

  it 'runs both the initializer and locale tasks' do
    gen = generator
    expect(gen).to receive :copy_initializer
    expect(gen).to receive :copy_locale
    expect(gen).to receive(:readme).and_return(true)
    gen.invoke_all
  end

  describe 'the generated files' do
    context 'with active_record orm as default' do
      before do
        run_generator
      end

      describe 'the initializer' do
        subject { file('config/initializers/activity_notification.rb') }
        it { is_expected.to exist }
        it { is_expected.to contain(/ActivityNotification.configure do |config|/) }
      end

      describe 'the locale file' do
        subject { file('config/locales/activity_notification.en.yml') }
        it { is_expected.to exist }
        it { is_expected.to contain(/en:\n.+notification:\n.+default:/) }
      end
    end

    context 'with orm option as not :active_record' do
      it 'raises MissingORMError' do
        expect { run_generator %w(--orm dummy) }
        .to raise_error(TypeError)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
activity_notification-2.3.2 spec/generators/install_generator_spec.rb
activity_notification-2.3.1 spec/generators/install_generator_spec.rb
activity_notification-2.3.0 spec/generators/install_generator_spec.rb
activity_notification-2.2.4 spec/generators/install_generator_spec.rb
activity_notification-2.2.3 spec/generators/install_generator_spec.rb
activity_notification-2.2.2 spec/generators/install_generator_spec.rb
activity_notification-2.2.1 spec/generators/install_generator_spec.rb
activity_notification-2.2.0 spec/generators/install_generator_spec.rb
activity_notification-2.1.4 spec/generators/install_generator_spec.rb
activity_notification-2.1.3 spec/generators/install_generator_spec.rb
activity_notification-2.1.2 spec/generators/install_generator_spec.rb
activity_notification-2.1.1 spec/generators/install_generator_spec.rb
activity_notification-2.1.0 spec/generators/install_generator_spec.rb
activity_notification-2.0.0 spec/generators/install_generator_spec.rb
activity_notification-1.7.1 spec/generators/install_generator_spec.rb
activity_notification-1.7.0 spec/generators/install_generator_spec.rb
activity_notification-1.6.1 spec/generators/install_generator_spec.rb
activity_notification-1.6.0 spec/generators/install_generator_spec.rb
activity_notification-1.5.1 spec/generators/install_generator_spec.rb
activity_notification-1.5.0 spec/generators/install_generator_spec.rb