spec/migrate_spec.rb in rbenv-migrate-0.2 vs spec/migrate_spec.rb in rbenv-migrate-0.2.1

- old
+ new

@@ -1,7 +1,6 @@ require "spec_helper" -require "stringio" # Arbitrary valid old version OLD_VERSION = "2.7.8" def set_version(version=OLD_VERSION) @@ -45,10 +44,12 @@ args_should_trigger_help_screen RUBY_VERSION end end describe "#run" do + before(:each) { expect(Optimist).not_to receive :educate } + context "when there are no gems to migrate" do it "prints a message and exits" do allow(cli).to receive(:gemspecs_for).and_return([]) expect { cli.run }.to output(/appear to be up-to-date/). to_stdout.and raise_error(SystemExit) @@ -73,11 +74,10 @@ let var do send(:"#{var}_names").map do |name| Gem::Specification.new do |gem| gem.name = name gem.version = "0.1" - gem.required_ruby_version = ">= #{OLD_VERSION}" end end end end @@ -92,17 +92,23 @@ let :old_gems do %w[gem1 gem2 gem3].each_with_index.map do |name, i| Gem::Specification.new do |gem| gem.name = name gem.version = "0.1" - # First one tested will be skipped + # First one will be skipped gem.required_ruby_version = "#{i == 0 ? '~>' : '>='} #{OLD_VERSION}" end end end - let(:result) { %w[gem2 gem3] } + let(:result) { %w[gem2 gem3] } + it "passes the correct gems to RubyGems" do + expect(install_command_double).to receive(:handle_options).with(result) + cli.run + end + + it "outputs that it is skipping that gem" do allow(install_command_double).to receive(:handle_options).with(result) expect { cli.run }.to output(/skipping/).to_stderr end end end