diff --git a/spec/lib/polariscope/scanner/gem_versions_spec.rb b/spec/lib/polariscope/scanner/gem_versions_spec.rb index a3a5ccc..17841eb 100644 --- a/spec/lib/polariscope/scanner/gem_versions_spec.rb +++ b/spec/lib/polariscope/scanner/gem_versions_spec.rb @@ -27,14 +27,20 @@ end describe '#versions_for' do - let(:dependencies) { ['devise', 'rails'] } - before { allow(Polariscope::Scanner::RubyVersions).to receive(:available_versions) } - it 'returns only distinct versions for given gem name' do - expect(scanner.versions_for('devise').map(&:to_s)).to contain_exactly('4.6.2', '4.5.0') + context 'when ruby is not in dependencies' do + let(:dependencies) { ['devise', 'rails'] } + + it 'returns distinct versions for given gem name' do + expect(scanner.versions_for('devise').map(&:to_s)).to contain_exactly('4.6.2', '4.5.0') + end + + it "doesn't fetch ruby versions" do + scanner - expect(Polariscope::Scanner::RubyVersions).not_to have_received(:available_versions) + expect(Polariscope::Scanner::RubyVersions).not_to have_received(:available_versions) + end end context 'when ruby is in dependencies' do