Sha256: c70cb13bd3f323a0cdc918aef7e76f4df5bd05d6a6a39506be68b71a08cf2f15

Contents?: true

Size: 697 Bytes

Versions: 11

Compression:

Stored size: 697 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe TTY::Plugins, '#find' do
  let(:object)  { described_class }
  let(:tty_gem) { Gem::Specification.new('tty-console', '3.1.3')}
  let(:gem)     { Gem::Specification.new('thor', '1.1.4') }
  let(:gems)    { [gem, tty_gem] }

  before {
    allow(Gem).to receive(:refresh)
    allow(Gem::Specification).to receive(:each).and_yield(tty_gem).and_yield(gem)
  }

  subject { object.new }

  it 'inserts the tty gem only' do
    found = subject.find
    expect(found.size).to eq(1)
    expect(found.first.gem).to eql(tty_gem)
  end

  it 'retrieves only tty plugin' do
    subject.find
    expect(subject.names['console'].gem).to eql(tty_gem)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tty-0.5.0 spec/tty/plugins/find_spec.rb
tty-0.4.0 spec/tty/plugins/find_spec.rb
tty-0.3.2 spec/tty/plugins/find_spec.rb
tty-0.3.1 spec/tty/plugins/find_spec.rb
tty-0.3.0 spec/tty/plugins/find_spec.rb
tty-0.2.1 spec/tty/plugins/find_spec.rb
tty-0.2.0 spec/tty/plugins/find_spec.rb
tty-0.1.3 spec/tty/plugins/find_spec.rb
tty-0.1.2 spec/tty/plugins/find_spec.rb
tty-0.1.1 spec/tty/plugins/find_spec.rb
tty-0.1.0 spec/tty/plugins/find_spec.rb