forked from prontolabs/pronto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpronto_spec.rb
38 lines (33 loc) · 1.06 KB
/
pronto_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'spec_helper'
describe Pronto do
describe '.gem_names' do
subject { Pronto.gem_names }
before { Gem::Specification.should_receive(:find_all) { gems } }
context 'properly named gem' do
let(:gems) { [double(name: 'pronto-rubocop')] }
it { should include('rubocop') }
end
context 'duplicate names' do
let(:gem) { double(name: 'pronto-rubocop') }
let(:gems) { [gem, gem] }
it { should include('rubocop') }
its(:count) { should == 1 }
end
context 'inproperly named gem' do
context 'with good path' do
let(:gems) { [double(name: 'good', full_gem_path: '/good')] }
before do
File.stub(:exist?).with('/good/lib/pronto/good.rb').and_return(true)
end
it { should include('good') }
end
context 'with bad path' do
let(:gems) { [double(name: 'bad', full_gem_path: '/bad')] }
before do
File.stub(:exist?).with('/bad/lib/pronto/bad.rb').and_return(false)
end
it { should_not include('bad') }
end
end
end
end