diff options
Diffstat (limited to 'spec/bundler/source_spec.rb')
-rw-r--r-- | spec/bundler/source_spec.rb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/bundler/source_spec.rb b/spec/bundler/source_spec.rb index 4e99411a17..08d1698fcd 100644 --- a/spec/bundler/source_spec.rb +++ b/spec/bundler/source_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "spec_helper" -describe Bundler::Source do +RSpec.describe Bundler::Source do class ExampleSource < Bundler::Source end @@ -61,7 +61,7 @@ describe Bundler::Source do before { Bundler.ui = Bundler::UI::Shell.new } it "should return a string with the spec name and version and locked spec version" do - expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (\e[32mwas < 1.5\e[0m)") + expect(subject.version_message(spec)).to eq("nokogiri >= 1.6\e[32m (was < 1.5)\e[0m") end end @@ -71,6 +71,32 @@ describe Bundler::Source do end end end + + context "with a more recent version" do + let(:spec) { double(:spec, :name => "nokogiri", :version => "1.6.1", :platform => rb) } + let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "1.7.0") } + + context "with color" do + before { Bundler.ui = Bundler::UI::Shell.new } + + it "should return a string with the locked spec version in yellow" do + expect(subject.version_message(spec)).to eq("nokogiri 1.6.1\e[33m (was 1.7.0)\e[0m") + end + end + end + + context "with an older version" do + let(:spec) { double(:spec, :name => "nokogiri", :version => "1.7.1", :platform => rb) } + let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "1.7.0") } + + context "with color" do + before { Bundler.ui = Bundler::UI::Shell.new } + + it "should return a string with the locked spec version in green" do + expect(subject.version_message(spec)).to eq("nokogiri 1.7.1\e[32m (was 1.7.0)\e[0m") + end + end + end end context "that do not contain the relevant gem spec" do |