Sha256: 0cb8e88428596170ec7180ca8860e38fb6d80672f80552919190307b26397315

Contents?: true

Size: 958 Bytes

Versions: 7

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'

describe SearchKit::Messages do
  let(:messages) { described_class.new }
  let(:message) { "Just about any string" }

  before do
    SearchKit.config.verbose = true

    allow(Kernel).to receive(:warn)
    allow(Kernel).to receive(:puts)
    allow(SearchKit.logger).to receive(:warn)
    allow(SearchKit.logger).to receive(:info)
  end

  after { SearchKit.config.verbose = false }

  describe "#info" do
    subject { messages.info(message) }

    it "warns in stderr" do
      expect(Kernel).to receive(:puts)
      subject
    end

    it "logs a warning" do
      expect(SearchKit.logger).to receive(:info).with(message)
      subject
    end
  end

  describe "#warning" do
    subject { messages.warning(message) }

    it "warns in stderr" do
      expect(Kernel).to receive(:warn)
      subject
    end

    it "logs a warning" do
      expect(SearchKit.logger).to receive(:warn).with(message)
      subject
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
search-kit-0.0.10 spec/search_kit/messages_spec.rb
search-kit-0.0.9 spec/search_kit/messages_spec.rb
search-kit-0.0.8 spec/search_kit/messages_spec.rb
search-kit-0.0.7 spec/search_kit/messages_spec.rb
search-kit-0.0.6 spec/search_kit/messages_spec.rb
search-kit-0.0.5 spec/search_kit/messages_spec.rb
search-kit-0.0.4 spec/search_kit/messages_spec.rb