Sha256: bcc37ce04131486022aa3b747f901d8b8fefe521882a4996da775f095cb6d077

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

# This is the only file the plugin should require
require 'guard/compat/test/helper'
require 'guard/compat/example'

RSpec.describe Guard::MyPlugin, exclude_stubs: [Guard::Plugin] do
  let(:options) { { foo: :bar } }
  subject { described_class.new(options) }

  before do
    allow(Guard::Notifier).to receive(:notify)
    %w(info warning error deprecation debug).each do |type|
      allow(Guard::UI).to receive(type.to_sym)
    end
  end

  it 'passes options' do
    expect(subject.options).to include(foo: :bar)
  end

  it 'uses the notifier' do
    expect(Guard::Notifier).to receive(:notify).with('foo')
    subject.start
  end

  it 'uses the notifier with options' do
    expect(Guard::Notifier).to receive(:notify).with('foo', title: 'bar')
    subject.run_all
  end

  %w(info warning error deprecation debug).each do |type|
    it "outputs #{type} messages" do
      expect(Guard::UI).to receive(type.to_sym).with('foo')
      subject.start
    end

    it "outputs #{type} messages with options" do
      expect(Guard::UI).to receive(type.to_sym).with('foo', bar: :baz)
      subject.run_all
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guard-compat-0.2.0 spec/guard/compat/example_spec.rb
guard-compat-0.1.1 spec/guard/compat/example_spec.rb
guard-compat-0.1.0 spec/guard/compat/example_spec.rb
guard-compat-0.0.2 spec/guard/compat/example_spec.rb