Sha256: b6303da21c172ae21aa520a623a2e095d5fac7253cc3eddcf61f3fa57bf98371

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'spec_helper'

describe TTY::Plugin, '#load!' do
  let(:gem) { Gem::Specification.new('tty-console', '3.1.3')}
  let(:name) { 'console'}
  let(:input)  { StringIO.new }
  let(:output) { StringIO.new }

  subject { described_class.new(name, gem) }

  context 'when gem unsuccessfully loaded' do
    before { Kernel.stub(:require) { raise LoadError } }

    it 'fails to load the gem' do
      TTY.shell.should_receive(:error).with(/Unable to load plugin tty-console./)
      subject.load!
    end
  end

  context 'when gem unsuccessfully required' do
    before { Kernel.stub(:require) { raise StandardError } }

    it 'fails to require the gem' do
      TTY.shell.should_receive(:error).with(/Unable to load plugin tty-console./)
      subject.load!
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/plugins/plugin/load_spec.rb
tty-0.0.10 spec/tty/plugins/plugin/load_spec.rb