diff options
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/dsl_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/fetcher/compact_index_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/gem_helper_spec.rb | 28 | ||||
-rw-r--r-- | spec/bundler/source_spec.rb | 36 |
4 files changed, 44 insertions, 26 deletions
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index 214d159d05..69e4107408 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -98,8 +98,8 @@ RSpec.describe Bundler::Dsl do end describe "#gem" do - [:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :mri, :mri_18, :mri_19, - :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :jruby, :rbx, :truffleruby].each do |platform| + [:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :mri, :mri_18, :mri_19, + :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26, :jruby, :rbx, :truffleruby].each do |platform| it "allows #{platform} as a valid platform" do subject.gem("foo", :platform => platform) end diff --git a/spec/bundler/fetcher/compact_index_spec.rb b/spec/bundler/fetcher/compact_index_spec.rb index 2f622f6653..f5ae6f4d77 100644 --- a/spec/bundler/fetcher/compact_index_spec.rb +++ b/spec/bundler/fetcher/compact_index_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Bundler::Fetcher::CompactIndex do end it "calls worker#stop during the run" do - expect_any_instance_of(Bundler::Worker).to receive(:stop).at_least(:once) + expect_any_instance_of(Bundler::Worker).to receive(:stop).at_least(:once).and_call_original compact_index.specs_for_names(["lskdjf"]) end diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index daf76048ee..a21fd4c835 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -11,6 +11,7 @@ RSpec.describe Bundler::GemHelper do before(:each) do global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false" bundle "gem #{app_name}" + prepare_gemspec(app_gemspec_path) end context "determining gemspec" do @@ -218,15 +219,26 @@ RSpec.describe Bundler::GemHelper do end end - it "on releasing" do - mock_build_message app_name, app_version - mock_confirm_message "Tagged v#{app_version}." - mock_confirm_message "Pushed git commits and tags." - expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) + context "on releasing" do + before do + mock_build_message app_name, app_version + mock_confirm_message "Tagged v#{app_version}." + mock_confirm_message "Pushed git commits and tags." - Dir.chdir(app_path) { sys_exec("git push -u origin master") } + Dir.chdir(app_path) { sys_exec("git push -u origin master") } + end - Rake.application["release"].invoke + it "calls rubygem_push with proper arguments" do + expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s) + + Rake.application["release"].invoke + end + + it "uses Kernel.system" do + expect(Kernel).to receive(:system).with("gem", "push", app_gem_path.to_s, "--host", "http://example.org").and_return(true) + + Rake.application["release"].invoke + end end it "even if tag already exists" do @@ -249,7 +261,7 @@ RSpec.describe Bundler::GemHelper do before(:each) do Rake.application = Rake::Application.new subject.install - allow(subject).to receive(:sh) + allow(subject).to receive(:sh_with_input) end after(:each) do diff --git a/spec/bundler/source_spec.rb b/spec/bundler/source_spec.rb index d70fd7e549..9ae6b3e3eb 100644 --- a/spec/bundler/source_spec.rb +++ b/spec/bundler/source_spec.rb @@ -56,19 +56,17 @@ RSpec.describe Bundler::Source do context "with a different version" do let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "< 1.5") } - context "with color" do + context "with color", :non_windows do before { Bundler.ui = Bundler::UI::Shell.new } it "should return a string with the spec name and version and locked spec version" do - if Bundler.ui.instance_variable_get(:@shell).is_a?(Bundler::Thor::Shell::Basic) - skip "tty color is not supported with Thor::Shell::Basic environment." - end - expect(subject.version_message(spec)).to eq("nokogiri >= 1.6\e[32m (was < 1.5)\e[0m") end end context "without color" do + before { Bundler.ui = Bundler::UI::Shell.new("no-color" => true) } + 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 (was < 1.5)") end @@ -79,34 +77,42 @@ RSpec.describe Bundler::Source 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 + context "with color", :non_windows do before { Bundler.ui = Bundler::UI::Shell.new } it "should return a string with the locked spec version in yellow" do - if Bundler.ui.instance_variable_get(:@shell).is_a?(Bundler::Thor::Shell::Basic) - skip "tty color is not supported with Thor::Shell::Basic environment." - end - expect(subject.version_message(spec)).to eq("nokogiri 1.6.1\e[33m (was 1.7.0)\e[0m") end end + + context "without color" do + before { Bundler.ui = Bundler::UI::Shell.new("no-color" => true) } + + it "should return a string with the locked spec version in yellow" do + expect(subject.version_message(spec)).to eq("nokogiri 1.6.1 (was 1.7.0)") + 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 + context "with color", :non_windows do before { Bundler.ui = Bundler::UI::Shell.new } it "should return a string with the locked spec version in green" do - if Bundler.ui.instance_variable_get(:@shell).is_a?(Bundler::Thor::Shell::Basic) - skip "tty color is not supported with Thor::Shell::Basic environment." - end - expect(subject.version_message(spec)).to eq("nokogiri 1.7.1\e[32m (was 1.7.0)\e[0m") end end + + context "without color" do + before { Bundler.ui = Bundler::UI::Shell.new("no-color" => true) } + + it "should return a string with the locked spec version in yellow" do + expect(subject.version_message(spec)).to eq("nokogiri 1.7.1 (was 1.7.0)") + end + end end end |