Sha256: 49ffe35ded2a49e0d12624ce31f3286ab8d680ed78e47f3f049c02a5ca00860b

Contents?: true

Size: 1.48 KB

Versions: 12

Compression:

Stored size: 1.48 KB

Contents

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

describe RakeNBake::Baker 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

12 entries across 12 versions & 1 rubygems

Version Path
rake-n-bake-3.1.2 spec/baker_spec.rb
rake-n-bake-3.1.1 spec/baker_spec.rb
rake-n-bake-3.1.0 spec/baker_spec.rb
rake-n-bake-3.0.0 spec/baker_spec.rb
rake-n-bake-2.1.4 spec/baker_spec.rb
rake-n-bake-2.1.3 spec/baker_spec.rb
rake-n-bake-2.1.2 spec/baker_spec.rb
rake-n-bake-2.1.1 spec/baker_spec.rb
rake-n-bake-2.1.0 spec/baker_spec.rb
rake-n-bake-2.0.1 spec/baker_spec.rb
rake-n-bake-2.0.0 spec/baker_spec.rb
rake-n-bake-1.4.3 spec/baker_spec.rb