Sha256: 0b76ec0284a98e19053a07cd0d6405405800d584cb3e469cf434d9271ccb5c51

Contents?: true

Size: 1.47 KB

Versions: 19

Compression:

Stored size: 1.47 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
    meths = %w(info warning error deprecation debug notify color color_enabled?)
    meths.each do |type|
      allow(Guard::Compat::UI).to receive(type.to_sym)
    end
  end

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

  it 'works without options' do
    expect { described_class.new }.to_not raise_error
  end

  describe '#start' do
    before { subject.start }
    %w(info warning error deprecation debug notify).each do |type|
      specify do
        expect(Guard::Compat::UI).to have_received(type.to_sym).with('foo')
      end
    end
  end

  describe '#run_all' do
    before { subject.run_all }
    %w(info warning error deprecation debug notify).each do |type|
      specify do
        expect(Guard::Compat::UI).to have_received(type.to_sym)
          .with('foo', bar: :baz)
      end
    end
  end

  describe '#run_on_modifications' do
    before do
      allow(Guard::Compat).to receive(:matching_files)
      allow(Guard::Compat).to receive(:watched_directories)
    end

    before { subject.run_on_modifications }
    specify { expect(Guard::Compat::UI).to have_received(:color_enabled?) }
    specify { expect(Guard::Compat).to have_received(:matching_files) }
  end
end

Version data entries

19 entries across 19 versions & 9 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
geminfo-0.1.0 path/gems/guard-compat-1.2.1/spec/guard/compat/example_spec.rb
guard-compat-1.2.1 spec/guard/compat/example_spec.rb
guard-compat-1.2.0 spec/guard/compat/example_spec.rb
guard-compat-1.1.0 spec/guard/compat/example_spec.rb