Sha256: e668c3fc3042285b0971aefa1024a8db8f4fd6f7343923dc990f5743e96ab528

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

# encoding: utf-8
require 'spec_helper'
require production_code

describe RakeNBake::AssistantBaker do
  describe '#log_step' do
    it 'puts the given message' do
      expect{described_class.log_step 'Foo'}.to output(/Foo/).to_stdout
    end

    it 'prints an attractive dot before the message' do
      expect{described_class.log_step 'Foo'}.to output(/● Foo/).to_stdout
    end
  end

  describe '#log_warn' do
    it 'puts the given message' do
      expect{described_class.log_warn 'Foo'}.to output(/Foo/).to_stdout
    end

    it 'prints an attractive dot before the message' do
      expect{described_class.log_warn 'Foo'}.to output(/● Foo/).to_stdout
    end
  end

  describe '#log_passed' do
    it 'puts the given message' do
      expect{described_class.log_passed 'Foo'}.to output(/Foo/).to_stdout
    end

    it 'prints the message in green' do
      expect{described_class.log_passed 'Foo'}.to output("#{Term::ANSIColor.green}Foo#{Term::ANSIColor.reset}\n").to_stdout
    end
  end

  describe '#log_missing_gem' do
    it 'puts a message asking for the gem to be installed' do
      expect{described_class.log_missing_gem 'foo'}.to output(/Try adding "gem 'foo'"/).to_stderr
    end

    it 'can optionally take a different name for the tool' do
      expect{described_class.log_missing_gem 'foo', 'Bar'}.to output(/'Bar' is not available/).to_stderr
      expect{described_class.log_missing_gem 'foo', 'Bar'}.to output(/Try adding "gem 'foo'"/).to_stderr
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake-n-bake-1.3.0 spec/assistant_baker_spec.rb
rake-n-bake-1.2.0 spec/assistant_baker_spec.rb
rake-n-bake-1.1.5 spec/assistant_baker_spec.rb
rake-n-bake-1.1.4 spec/assistant_baker_spec.rb