Sha256: 5f175a2fd3636ce65175a86315707545b04361e5807b8304a4e5f1ac7ceea2b0

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'generators/activity_notification/models/notification_generator'

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

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

  it 'runs generating model tasks' do
    gen = generator
    expect(gen).to receive :create_models
    gen.invoke_all
  end

  describe 'the generated files' do
    context 'without name argument' do
      before do
        run_generator
      end

      describe 'app/models/notification.rb' do
        subject { file('app/models/notification.rb') }
        it { is_expected.to exist }
        it { is_expected.to contain(/class Notification < ActivityNotification::Notification/) }
      end
    end

    context 'with CustomNotification as name argument' do
      before do
        run_generator %w(CustomNotification)
      end

      describe 'app/models/notification.rb' do
        subject { file('app/models/custom_notification.rb') }
        it { is_expected.to exist }
        it { is_expected.to contain(/class CustomNotification < ActivityNotification::Notification/) }
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activity_notification-1.0.1 spec/generators/models/notification_generator_spec.rb
activity_notification-1.0.0 spec/generators/models/notification_generator_spec.rb
activity_notification-0.0.10 spec/generators/models/notification_generator_spec.rb
activity_notification-0.0.9 spec/generators/models/notification_generator_spec.rb