diff options
author | Terence Lee <hone02@gmail.com> | 2012-10-09 16:50:55 -1000 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2012-10-09 16:51:54 -1000 |
commit | 944a78293b0bc0f508a70ee99530d251297c5bcc (patch) | |
tree | 241595f7f787339e934b1c89cda83a287faa1c3b | |
parent | 3fa809a13eeded67b1e8b3e421071f40c1f4b8f4 (diff) | |
download | bundler-944a78293b0bc0f508a70ee99530d251297c5bcc.tar.gz |
change to new expect syntax for rspec
57 files changed, 724 insertions, 720 deletions
diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 21db5eb54e..034a571314 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -22,4 +22,4 @@ describe Bundler::Definition do end end -end
\ No newline at end of file +end diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index f112243f4a..334fe6001c 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -10,19 +10,19 @@ describe Bundler::Dsl do it "should convert :github to :git" do subject.gem("sparks", :github => "indirect/sparks") github_uri = "git://github.com/indirect/sparks.git" - subject.dependencies.first.source.uri.should == github_uri + expect(subject.dependencies.first.source.uri).to eq(github_uri) end it "should convert 'rails' to 'rails/rails'" do subject.gem("rails", :github => "rails") github_uri = "git://github.com/rails/rails.git" - subject.dependencies.first.source.uri.should == github_uri + expect(subject.dependencies.first.source.uri).to eq(github_uri) end it "should interpret slashless 'github:' value as account name" do subject.gem("bundler", :github => "carlhuda") github_uri = "git://github.com/carlhuda/bundler.git" - subject.dependencies.first.source.uri.should == github_uri + expect(subject.dependencies.first.source.uri).to eq(github_uri) end end @@ -32,24 +32,24 @@ describe Bundler::Dsl do Bundler.should_receive(:read_file).with("Gemfile").and_return("unknown") error_msg = "Undefined local variable or method `unknown'" \ " for Gemfile\\s+from Gemfile:1" - lambda{ subject.eval_gemfile("Gemfile") }. - should raise_error(Bundler::GemfileError, Regexp.new(error_msg)) + expect { subject.eval_gemfile("Gemfile") }. + to raise_error(Bundler::GemfileError, Regexp.new(error_msg)) end end describe "#eval_gemfile" do it "handles syntax errors with a useful message" do Bundler.should_receive(:read_file).with("Gemfile").and_return("}") - lambda{ subject.eval_gemfile("Gemfile") }. - should raise_error(Bundler::GemfileError, /Gemfile syntax error/) + expect { subject.eval_gemfile("Gemfile") }. + to raise_error(Bundler::GemfileError, /Gemfile syntax error/) end end describe "syntax errors" do it "should raise a Bundler::GemfileError" do gemfile "gem 'foo', :path => /unquoted/string/syntax/error" - lambda { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }. - should raise_error(Bundler::GemfileError) + expect { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }. + to raise_error(Bundler::GemfileError) end end end diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index 426760401e..1d6eb5aec9 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -8,7 +8,7 @@ describe "Bundler::GemHelper tasks" do bundle 'gem test' app = bundled_app("test") helper = Bundler::GemHelper.new(app.to_s) - helper.gemspec.name.should == 'test' + expect(helper.gemspec.name).to eq('test') end it "interpolates the name for a hidden gemspec" do @@ -16,28 +16,28 @@ describe "Bundler::GemHelper tasks" do app = bundled_app("test") FileUtils.mv app.join('test.gemspec'), app.join('.gemspec') helper = Bundler::GemHelper.new(app.to_s) - helper.gemspec.name.should == 'test' + expect(helper.gemspec.name).to eq('test') end it "should fail when there is no gemspec" do bundle 'gem test' app = bundled_app("test") FileUtils.rm(File.join(app.to_s, 'test.gemspec')) - proc { Bundler::GemHelper.new(app.to_s) }.should raise_error(/Unable to determine name/) + expect { Bundler::GemHelper.new(app.to_s) }.to raise_error(/Unable to determine name/) end it "should fail when there are two gemspecs and the name isn't specified" do bundle 'gem test' app = bundled_app("test") File.open(File.join(app.to_s, 'test2.gemspec'), 'w') {|f| f << ''} - proc { Bundler::GemHelper.new(app.to_s) }.should raise_error(/Unable to determine name/) + expect { Bundler::GemHelper.new(app.to_s) }.to raise_error(/Unable to determine name/) end it "handles namespaces and converting to CamelCase" do bundle 'gem test-foo_bar' lib = bundled_app('test-foo_bar').join('lib/test-foo_bar.rb').read - lib.should include("module Test") - lib.should include("module FooBar") + expect(lib).to include("module Test") + expect(lib).to include("module FooBar") end end @@ -59,7 +59,7 @@ describe "Bundler::GemHelper tasks" do end it "uses a shell UI for output" do - Bundler.ui.should be_a(Bundler::UI::Shell) + expect(Bundler.ui).to be_a(Bundler::UI::Shell) end describe 'install_tasks' do @@ -75,20 +75,20 @@ describe "Bundler::GemHelper tasks" do names = %w[build install release] names.each { |name| - proc { Rake.application[name] }.should raise_error(/Don't know how to build task/) + expect { Rake.application[name] }.to raise_error(/Don't know how to build task/) } @helper.install names.each { |name| - proc { Rake.application[name] }.should_not raise_error - Rake.application[name].should be_instance_of Rake::Task + expect { Rake.application[name] }.not_to raise_error + expect(Rake.application[name]).to be_instance_of Rake::Task } end it "provides a way to access the gemspec object" do @helper.install - Bundler::GemHelper.gemspec.name.should == 'test' + expect(Bundler::GemHelper.gemspec.name).to eq('test') end end @@ -96,13 +96,13 @@ describe "Bundler::GemHelper tasks" do it "builds" do mock_build_message @helper.build_gem - bundled_app('test/pkg/test-0.0.1.gem').should exist + expect(bundled_app('test/pkg/test-0.0.1.gem')).to exist end it "raises an appropriate error when the build fails" do # break the gemspec by adding back the TODOs... File.open("#{@app.to_s}/test.gemspec", 'w'){|f| f << @gemspec } - proc { @helper.build_gem }.should raise_error(/TODO/) + expect { @helper.build_gem }.to raise_error(/TODO/) end end @@ -111,8 +111,8 @@ describe "Bundler::GemHelper tasks" do mock_build_message mock_confirm_message "test (0.0.1) installed" @helper.install_gem - bundled_app('test/pkg/test-0.0.1.gem').should exist - %x{gem list}.should include("test (0.0.1)") + expect(bundled_app('test/pkg/test-0.0.1.gem')).to exist + expect(%x{gem list}).to include("test (0.0.1)") end it "raises an appropriate error when the install fails" do @@ -123,13 +123,13 @@ describe "Bundler::GemHelper tasks" do File.open(path, 'w'){|f| f << "not actually a gem"} path end - proc { @helper.install_gem }.should raise_error + expect { @helper.install_gem }.to raise_error end end describe 'release' do it "shouldn't push if there are uncommitted files" do - proc { @helper.release_gem }.should raise_error(/files that need to be committed/) + expect { @helper.release_gem }.to raise_error(/files that need to be committed/) end it 'raises an appropriate error if there is no git remote' do @@ -145,7 +145,7 @@ describe "Bundler::GemHelper tasks" do `git commit -a -m "initial commit"` } - proc { @helper.release_gem }.should raise_error + expect { @helper.release_gem }.to raise_error end it "releases" do diff --git a/spec/bundler/source_spec.rb b/spec/bundler/source_spec.rb index 41440f1075..c51d4b9925 100644 --- a/spec/bundler/source_spec.rb +++ b/spec/bundler/source_spec.rb @@ -7,18 +7,18 @@ describe Bundler::Source::Rubygems do describe "caches" do it "should include Bundler.app_cache" do - subject.caches.should include(Bundler.app_cache) + expect(subject.caches).to include(Bundler.app_cache) end it "should include GEM_PATH entries" do Gem.path.each do |path| - subject.caches.should include(File.expand_path("#{path}/cache")) + expect(subject.caches).to include(File.expand_path("#{path}/cache")) end end it "should be an array of strings or pathnames" do subject.caches.each do |cache| - [String, Pathname].should include(cache.class) + expect([String, Pathname]).to include(cache.class) end end end diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index 5270cd2411..8f4170146d 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -13,7 +13,7 @@ describe "bundle cache" do end it "copies the .gem file to vendor/cache" do - bundled_app("vendor/cache/rack-1.0.0.gem").should exist + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end it "uses the cache as a source when installing gems" do @@ -70,7 +70,7 @@ describe "bundle cache" do bundle "cache" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end end @@ -102,7 +102,7 @@ describe "bundle cache" do bundle :cache - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end end @@ -115,23 +115,23 @@ describe "bundle cache" do gem "actionpack" G bundle :cache - cached_gem("rack-1.0.0").should exist - cached_gem("actionpack-2.3.2").should exist - cached_gem("activesupport-2.3.2").should exist + expect(cached_gem("rack-1.0.0")).to exist + expect(cached_gem("actionpack-2.3.2")).to exist + expect(cached_gem("activesupport-2.3.2")).to exist end it "re-caches during install" do cached_gem("rack-1.0.0").rmtree bundle :install - out.should include("Updating files in vendor/cache") - cached_gem("rack-1.0.0").should exist + expect(out).to include("Updating files in vendor/cache") + expect(cached_gem("rack-1.0.0")).to exist end it "adds and removes when gems are updated" do update_repo2 bundle 'update' - cached_gem("rack-1.2").should exist - cached_gem("rack-1.0.0").should_not exist + expect(cached_gem("rack-1.2")).to exist + expect(cached_gem("rack-1.0.0")).not_to exist end it "adds new gems and dependencies" do @@ -139,8 +139,8 @@ describe "bundle cache" do source "file://#{gem_repo2}" gem "rails" G - cached_gem("rails-2.3.2").should exist - cached_gem("activerecord-2.3.2").should exist + expect(cached_gem("rails-2.3.2")).to exist + expect(cached_gem("activerecord-2.3.2")).to exist end it "removes .gems for removed gems and dependencies" do @@ -148,9 +148,9 @@ describe "bundle cache" do source "file://#{gem_repo2}" gem "rack" G - cached_gem("rack-1.0.0").should exist - cached_gem("actionpack-2.3.2").should_not exist - cached_gem("activesupport-2.3.2").should_not exist + expect(cached_gem("rack-1.0.0")).to exist + expect(cached_gem("actionpack-2.3.2")).not_to exist + expect(cached_gem("activesupport-2.3.2")).not_to exist end it "removes .gems when gem changes to git source" do @@ -161,9 +161,9 @@ describe "bundle cache" do gem "rack", :git => "#{lib_path("rack-1.0")}" gem "actionpack" G - cached_gem("rack-1.0.0").should_not exist - cached_gem("actionpack-2.3.2").should exist - cached_gem("activesupport-2.3.2").should exist + expect(cached_gem("rack-1.0.0")).not_to exist + expect(cached_gem("actionpack-2.3.2")).to exist + expect(cached_gem("activesupport-2.3.2")).to exist end @@ -175,7 +175,7 @@ describe "bundle cache" do G bundle :cache - cached_gem("platform_specific-1.0-java").should exist + expect(cached_gem("platform_specific-1.0-java")).to exist end simulate_new_machine @@ -184,8 +184,8 @@ describe "bundle cache" do gem "platform_specific" G - cached_gem("platform_specific-1.0-#{Gem::Platform.local}").should exist - cached_gem("platform_specific-1.0-java").should exist + expect(cached_gem("platform_specific-1.0-#{Gem::Platform.local}")).to exist + expect(cached_gem("platform_specific-1.0-java")).to exist end it "doesn't remove gems with mismatched :rubygems_version or :date" do @@ -196,7 +196,7 @@ describe "bundle cache" do simulate_new_machine bundle :install - cached_gem("rack-1.0.0").should exist + expect(cached_gem("rack-1.0.0")).to exist end it "handles directories and non .gem files in the cache" do @@ -212,7 +212,7 @@ describe "bundle cache" do G bundle "cache" bundle "install" - out.should_not =~ /removing/i + expect(out).not_to match(/removing/i) end it "does not warn about all if it doesn't have any git/path dependency" do @@ -221,7 +221,7 @@ describe "bundle cache" do gem "rack" G bundle "cache" - out.should_not =~ /\-\-all/ + expect(out).not_to match(/\-\-all/) end it "should install gems with the name bundler in them (that aren't bundler)" do diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 480f847f22..b8aff44739 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -3,12 +3,12 @@ require "spec_helper" describe "git base name" do it "base_name should strip private repo uris" do source = Bundler::Source::Git.new("uri" => "git@github.com:bundler.git") - source.send(:base_name).should == "bundler" + expect(source.send(:base_name)).to eq("bundler") end it "base_name should strip network share paths" do source = Bundler::Source::Git.new("uri" => "//MachineName/ShareFolder") - source.send(:base_name).should == "ShareFolder" + expect(source.send(:base_name)).to eq("ShareFolder") end end @@ -23,9 +23,9 @@ end G bundle "#{cmd} --all" - bundled_app("vendor/cache/foo-1.0-#{ref}").should exist - bundled_app("vendor/cache/foo-1.0-#{ref}/.git").should_not exist - bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache").should be_file + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist + expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist + expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file FileUtils.rm_rf lib_path("foo-1.0") should_be_installed "foo 1.0" @@ -42,8 +42,8 @@ end bundle "install --path vendor/bundle" bundle "#{cmd} --all" - bundled_app("vendor/cache/foo-1.0-#{ref}").should exist - bundled_app("vendor/cache/foo-1.0-#{ref}/.git").should_not exist + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist + expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist FileUtils.rm_rf lib_path("foo-1.0") should_be_installed "foo 1.0" @@ -59,7 +59,7 @@ end bundle "#{cmd} --all" bundle "#{cmd} --all" - err.should == "" + expect(err).to eq("") FileUtils.rm_rf lib_path("foo-1.0") should_be_installed "foo 1.0" end @@ -79,17 +79,17 @@ end end ref = git.ref_for("master", 11) - ref.should_not == old_ref + expect(ref).not_to eq(old_ref) bundle "update" bundle "#{cmd} --all" - bundled_app("vendor/cache/foo-1.0-#{ref}").should exist - bundled_app("vendor/cache/foo-1.0-#{old_ref}").should_not exist + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist + expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist FileUtils.rm_rf lib_path("foo-1.0") run "require 'foo'" - out.should == "CACHE" + expect(out).to eq("CACHE") end it "uses the local repository to generate the cache" do @@ -104,7 +104,7 @@ end bundle "install" bundle "#{cmd} --all" - bundled_app("vendor/cache/foo-invalid-#{ref}").should exist + expect(bundled_app("vendor/cache/foo-invalid-#{ref}")).to exist # Updating the local still uses the local. update_git "foo" do |s| @@ -112,7 +112,7 @@ end end run "require 'foo'" - out.should == "LOCAL" + expect(out).to eq("LOCAL") end it "copies repository to vendor cache, including submodules" do @@ -136,8 +136,8 @@ end ref = git.ref_for("master", 11) bundle "#{cmd} --all" - bundled_app("vendor/cache/has_submodule-1.0-#{ref}").should exist - bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0").should exist + expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist + expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0")).to exist should_be_installed "has_submodule 1.0" end @@ -150,7 +150,7 @@ end bundle "#{cmd}" - out.should include("Your Gemfile contains path and git dependencies.") + expect(out).to include("Your Gemfile contains path and git dependencies.") end it "does not display warning message if cache_all is set in bundle config" do @@ -163,7 +163,7 @@ end bundle "#{cmd} --all" bundle "#{cmd}" - out.should_not include("Your Gemfile contains path and git dependencies.") + expect(out).not_to include("Your Gemfile contains path and git dependencies.") end end end diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index 94c451819a..324e1f131e 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -10,7 +10,7 @@ require "spec_helper" G bundle "#{cmd} --all" - bundled_app("vendor/cache/foo-1.0").should_not exist + expect(bundled_app("vendor/cache/foo-1.0")).not_to exist should_be_installed "foo 1.0" end @@ -22,8 +22,8 @@ require "spec_helper" G bundle "#{cmd} --all" - bundled_app("vendor/cache/foo-1.0").should exist - bundled_app("vendor/cache/foo-1.0/.bundlecache").should be_file + expect(bundled_app("vendor/cache/foo-1.0")).to exist + expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file FileUtils.rm_rf lib_path("foo-1.0") should_be_installed "foo 1.0" @@ -44,11 +44,11 @@ require "spec_helper" bundle "#{cmd} --all" - bundled_app("vendor/cache/foo-1.0").should exist + expect(bundled_app("vendor/cache/foo-1.0")).to exist FileUtils.rm_rf lib_path("foo-1.0") run "require 'foo'" - out.should == "CACHE" + expect(out).to eq("CACHE") end it "removes stale entries cache" do @@ -65,7 +65,7 @@ require "spec_helper" G bundle "#{cmd} --all" - bundled_app("vendor/cache/bar-1.0").should_not exist + expect(bundled_app("vendor/cache/bar-1.0")).not_to exist end it "raises a warning without --all" do @@ -76,8 +76,8 @@ require "spec_helper" G bundle cmd - out.should =~ /please pass the \-\-all flag/ - bundled_app("vendor/cache/foo-1.0").should_not exist + expect(out).to match(/please pass the \-\-all flag/) + expect(bundled_app("vendor/cache/foo-1.0")).not_to exist end it "stores the given flag" do @@ -96,7 +96,7 @@ require "spec_helper" G bundle cmd - bundled_app("vendor/cache/bar-1.0").should exist + expect(bundled_app("vendor/cache/bar-1.0")).to exist end it "can rewind chosen configuration" do @@ -115,7 +115,7 @@ require "spec_helper" G bundle "#{cmd} --no-all" - bundled_app("vendor/cache/baz-1.0").should_not exist + expect(bundled_app("vendor/cache/baz-1.0")).not_to exist end end -end
\ No newline at end of file +end diff --git a/spec/cache/platform_spec.rb b/spec/cache/platform_spec.rb index 7e136640af..901f3db188 100644 --- a/spec/cache/platform_spec.rb +++ b/spec/cache/platform_spec.rb @@ -42,16 +42,16 @@ describe "bundle cache with multiple platforms" do it "ensures that bundle install does not delete gems for other platforms" do bundle "install" - bundled_app("vendor/cache/rack-1.0.0.gem").should exist - bundled_app("vendor/cache/activesupport-2.3.5.gem").should exist - bundled_app("vendor/cache/activerecord-2.3.2.gem").should exist + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist + expect(bundled_app("vendor/cache/activerecord-2.3.2.gem")).to exist end it "ensures that bundle update does not delete gems for other platforms" do bundle "update" - bundled_app("vendor/cache/rack-1.0.0.gem").should exist - bundled_app("vendor/cache/activesupport-2.3.5.gem").should exist - bundled_app("vendor/cache/activerecord-2.3.2.gem").should exist + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist + expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist + expect(bundled_app("vendor/cache/activerecord-2.3.2.gem")).to exist end end diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index eb98f5ad25..698d552ff8 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -10,18 +10,18 @@ describe "install with --deployment or --frozen" do it "fails without a lockfile and says that --deployment requires a lock" do bundle "install --deployment" - out.should include("The --deployment flag requires a Gemfile.lock") + expect(out).to include("The --deployment flag requires a Gemfile.lock") end it "fails without a lockfile and says that --frozen requires a lock" do bundle "install --frozen" - out.should include("The --frozen flag requires a Gemfile.lock") + expect(out).to include("The --frozen flag requires a Gemfile.lock") end it "works after you try to deploy without a lock" do bundle "install --deployment" bundle :install, :exitstatus => true - exitstatus.should eq(0) + expect(exitstatus).to eq(0) should_be_installed "rack 1.0" end @@ -43,14 +43,14 @@ describe "install with --deployment or --frozen" do G bundle :install bundle "install --deployment --without test", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end it "works when you bundle exec bundle" do bundle :install bundle "install --deployment" bundle "exec bundle check", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end it "works when using path gems from the same path and the version is specified" do @@ -64,7 +64,7 @@ describe "install with --deployment or --frozen" do bundle :install bundle "install --deployment", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end describe "with an existing lockfile" do @@ -74,12 +74,12 @@ describe "install with --deployment or --frozen" do it "works with the --deployment flag if you didn't change anything" do bundle "install --deployment", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end it "works with the --frozen flag if you didn't change anything" do bundle "install --frozen", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end it "explodes with the --deployment flag if you make a change and don't check in the lockfile" do @@ -90,11 +90,11 @@ describe "install with --deployment or --frozen" do G bundle "install --deployment" - out.should include("deployment mode") - out.should include("You have added to the Gemfile") - out.should include("* rack-obama") - out.should_not include("You have deleted from the Gemfile") - out.should_not include("You have changed in the Gemfile") + expect(out).to include("deployment mode") + expect(out).to include("You have added to the Gemfile") + expect(out).to include("* rack-obama") + expect(out).not_to include("You have deleted from the Gemfile") + expect(out).not_to include("You have changed in the Gemfile") end it "can have --frozen set via an environment variable" do @@ -106,11 +106,11 @@ describe "install with --deployment or --frozen" do ENV['BUNDLE_FROZEN'] = '1' bundle "install" - out.should include("deployment mode") - out.should include("You have added to the Gemfile") - out.should include("* rack-obama") - out.should_not include("You have deleted from the Gemfile") - out.should_not include("You have changed in the Gemfile") + expect(out).to include("deployment mode") + expect(out).to include("You have added to the Gemfile") + expect(out).to include("* rack-obama") + expect(out).not_to include("You have deleted from the Gemfile") + expect(out).not_to include("You have changed in the Gemfile") end it "explodes with the --frozen flag if you make a change and don't check in the lockfile" do @@ -121,11 +121,11 @@ describe "install with --deployment or --frozen" do G bundle "install --frozen" - out.should include("deployment mode") - out.should include("You have added to the Gemfile") - out.should include("* rack-obama") - out.should_not include("You have deleted from the Gemfile") - out.should_not include("You have changed in the Gemfile") + expect(out).to include("deployment mode") + expect(out).to include("You have added to the Gemfile") + expect(out).to include("* rack-obama") + expect(out).not_to include("You have deleted from the Gemfile") + expect(out).not_to include("You have changed in the Gemfile") end it "explodes if you remove a gem and don't check in the lockfile" do @@ -135,10 +135,10 @@ describe "install with --deployment or --frozen" do G bundle "install --deployment" - out.should include("deployment mode") - out.should include("You have added to the Gemfile:\n* activesupport\n\n") - out.should include("You have deleted from the Gemfile:\n* rack") - out.should_not include("You have changed in the Gemfile") + expect(out).to include("deployment mode") + expect(out).to include("You have added to the Gemfile:\n* activesupport\n\n") + expect(out).to include("You have deleted from the Gemfile:\n* rack") + expect(out).not_to include("You have changed in the Gemfile") end it "explodes if you add a source" do @@ -148,9 +148,9 @@ describe "install with --deployment or --frozen" do G bundle "install --deployment" - out.should include("deployment mode") - out.should include("You have added to the Gemfile:\n* source: git://hubz.com (at master)") - out.should_not include("You have changed in the Gemfile") + expect(out).to include("deployment mode") + expect(out).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)") + expect(out).not_to include("You have changed in the Gemfile") end it "explodes if you unpin a source" do @@ -167,10 +167,10 @@ describe "install with --deployment or --frozen" do G bundle "install --deployment" - out.should include("deployment mode") - out.should include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master)") - out.should_not include("You have added to the Gemfile") - out.should_not include("You have changed in the Gemfile") + expect(out).to include("deployment mode") + expect(out).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master)") + expect(out).not_to include("You have added to the Gemfile") + expect(out).not_to include("You have changed in the Gemfile") end it "explodes if you unpin a source, leaving it pinned somewhere else" do @@ -190,10 +190,10 @@ describe "install with --deployment or --frozen" do G bundle "install --deployment" - out.should include("deployment mode") - out.should include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master)`") - out.should_not include("You have added to the Gemfile") - out.should_not include("You have deleted from the Gemfile") + expect(out).to include("deployment mode") + expect(out).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master)`") + expect(out).not_to include("You have added to the Gemfile") + expect(out).not_to include("You have deleted from the Gemfile") end it "remembers that the bundle is frozen at runtime" do diff --git a/spec/install/gems/c_ext_spec.rb b/spec/install/gems/c_ext_spec.rb index bc3e24520a..6f9fe22b70 100644 --- a/spec/install/gems/c_ext_spec.rb +++ b/spec/install/gems/c_ext_spec.rb @@ -40,9 +40,9 @@ describe "installing a gem with C extensions" do bundle "config build.c_extension --with-c_extension=hello" bundle "install" - out.should_not include("extconf.rb failed") + expect(out).not_to include("extconf.rb failed") run "Bundler.require; puts CExtension.new.its_true" - out.should == "true" + expect(out).to eq("true") end end diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index 1a94917f45..5880be03b7 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -10,7 +10,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint" - out.should include("Fetching gem metadata from #{source_uri}") + expect(out).to include("Fetching gem metadata from #{source_uri}") should_be_installed "rack 1.0.0" end @@ -21,7 +21,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint" - out.should include("Could not find gem ' sinatra") + expect(out).to include("Could not find gem ' sinatra") end it "should handle nested dependencies" do @@ -31,7 +31,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint" - out.should include("Fetching gem metadata from #{source_uri}/...") + expect(out).to include("Fetching gem metadata from #{source_uri}/...") should_be_installed( "rails 2.3.2", "actionpack 2.3.2", @@ -59,7 +59,7 @@ describe "gemcutter's dependency API" do bundle :install, :artifice => "endpoint" bundle "install --deployment", :artifice => "endpoint" - out.should include("Fetching gem metadata from #{source_uri}") + expect(out).to include("Fetching gem metadata from #{source_uri}") should_be_installed "rack 1.0.0" end @@ -108,7 +108,7 @@ describe "gemcutter's dependency API" do G bundle :install, :fakeweb => "windows" - out.should include("\nFetching full source index from #{source_uri}") + expect(out).to include("\nFetching full source index from #{source_uri}") should_be_installed "rcov 1.0.0" end @@ -124,7 +124,7 @@ describe "gemcutter's dependency API" do gem "rails" G bundle :install, :artifice => "endpoint_fallback" - out.should include("\nFetching full source index from #{source_uri}") + expect(out).to include("\nFetching full source index from #{source_uri}") should_be_installed( "activesupport 2.3.2", @@ -144,7 +144,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_marshal_fail" - out.should include("\nFetching full source index from #{source_uri}") + expect(out).to include("\nFetching full source index from #{source_uri}") should_be_installed "rack 1.0.0" end @@ -155,7 +155,7 @@ describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_redirect" - out.should match(/Too many redirects/) + expect(out).to match(/Too many redirects/) end context "when --full-index is specified" do @@ -166,7 +166,7 @@ describe "gemcutter's dependency API" do G bundle "install --full-index", :artifice => "endpoint" - out.should include("Fetching source index from #{source_uri}") + expect(out).to include("Fetching source index from #{source_uri}") should_be_installed "rack 1.0.0" end @@ -177,7 +177,7 @@ describe "gemcutter's dependency API" do G bundle "update --full-index", :artifice => "endpoint" - out.should include("Fetching source index from #{source_uri}") + expect(out).to include("Fetching source index from #{source_uri}") should_be_installed "rack 1.0.0" end end @@ -220,7 +220,7 @@ describe "gemcutter's dependency API" do Fetching gem metadata from http://localgemserver.test/.. Fetching gem metadata from http://localgemserver.test/extra/. OUTPUT - out.should include(output) + expect(out).to include(output) end it "does not fetch every specs if the index of gems is large when doing back deps" do @@ -286,7 +286,7 @@ OUTPUT G bundle :install, :artifice => "endpoint" - out.should include("Fetching gem metadata from #{source_uri}") + expect(out).to include("Fetching gem metadata from #{source_uri}") end it "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do @@ -310,7 +310,7 @@ OUTPUT bundle "install --binstubs", :artifice => "endpoint" gembin "rackup" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end it "installs the bins when using --path and uses autoclean" do @@ -321,7 +321,7 @@ OUTPUT bundle "install --path vendor/bundle", :artifice => "endpoint" - vendored_gems("bin/rackup").should exist + expect(vendored_gems("bin/rackup")).to exist end it "installs the bins when using --path and uses bundle clean" do @@ -332,7 +332,7 @@ OUTPUT bundle "install --path vendor/bundle --no-clean", :artifice => "endpoint" - vendored_gems("bin/rackup").should exist + expect(vendored_gems("bin/rackup")).to exist end it "prints post_install_messages" do @@ -342,7 +342,7 @@ OUTPUT G bundle :install, :artifice => "endpoint" - out.should include("Post-install message from rack:") + expect(out).to include("Post-install message from rack:") end it "should display the post install message for a dependency" do @@ -352,8 +352,8 @@ OUTPUT G bundle :install, :artifice => "endpoint" - out.should include("Post-install message from rack:") - out.should include("Rack's post install message") + expect(out).to include("Post-install message from rack:") + expect(out).to include("Rack's post install message") end context "when using basic authentication" do @@ -374,7 +374,7 @@ OUTPUT G bundle :install, :artifice => "endpoint_basic_authentication" - out.should_not include("#{user}:#{password}") + expect(out).not_to include("#{user}:#{password}") should_be_installed "rack 1.0.0" end @@ -385,7 +385,7 @@ OUTPUT G bundle :install, :artifice => "endopint_marshal_fail_basic_authentication" - out.should_not include("#{user}:#{password}") + expect(out).not_to include("#{user}:#{password}") should_be_installed "rack 1.0.0" end @@ -396,7 +396,7 @@ OUTPUT G bundle :install, :artifice => "endpoint_500" - out.should_not include("#{user}:#{password}") + expect(out).not_to include("#{user}:#{password}") end end @@ -429,7 +429,7 @@ OUTPUT bundle :install, :artifice => "endpoint", :env => {"RUBYOPT" => "-I#{bundled_app("broken_ssl")}"} - out.should include("Could not load OpenSSL.") + expect(out).to include("Could not load OpenSSL.") end end diff --git a/spec/install/gems/env_spec.rb b/spec/install/gems/env_spec.rb index 285c23b0fb..235a1ced32 100644 --- a/spec/install/gems/env_spec.rb +++ b/spec/install/gems/env_spec.rb @@ -104,4 +104,4 @@ describe "bundle install with ENV conditionals" do should_be_installed "rack 1.0" end end -end
\ No newline at end of file +end diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb index ac7f3ec33c..0da7784ed4 100644 --- a/spec/install/gems/flex_spec.rb +++ b/spec/install/gems/flex_spec.rb @@ -188,7 +188,7 @@ describe "bundle flex_install" do ruby <<-RUBY, :expect_err => true require 'bundler/setup' RUBY - err.should =~ /could not find gem 'rack-obama/i + expect(err).to match(/could not find gem 'rack-obama/i) end it "suggests bundle update when the Gemfile requires different versions than the lock" do @@ -207,7 +207,7 @@ describe "bundle flex_install" do E bundle :install - out.should == nice_error + expect(out).to eq(nice_error) end end @@ -227,13 +227,13 @@ describe "bundle flex_install" do end it "does something" do - lambda { + expect { bundle "install" - }.should_not change { File.read(bundled_app('Gemfile.lock')) } + }.not_to change { File.read(bundled_app('Gemfile.lock')) } - out.should include('rack = 0.9.1') - out.should include('locked at 1.0.0') - out.should include('bundle update rack') + expect(out).to include('rack = 0.9.1') + expect(out).to include('locked at 1.0.0') + expect(out).to include('bundle update rack') end it "should work when you update" do diff --git a/spec/install/gems/groups_spec.rb b/spec/install/gems/groups_spec.rb index 47123599fe..9f1c1574b5 100644 --- a/spec/install/gems/groups_spec.rb +++ b/spec/install/gems/groups_spec.rb @@ -26,7 +26,7 @@ describe "bundle install with gem sources" do puts ACTIVESUPPORT R - err.should == "ZOMG LOAD ERROR" + expect(err).to eq("ZOMG LOAD ERROR") end it "installs gems with inline :groups into those groups" do @@ -37,18 +37,18 @@ describe "bundle install with gem sources" do puts THIN R - err.should == "ZOMG LOAD ERROR" + expect(err).to eq("ZOMG LOAD ERROR") end it "sets up everything if Bundler.setup is used with no groups" do out = run("require 'rack'; puts RACK") - out.should eq('1.0.0') + expect(out).to eq('1.0.0') out = run("require 'activesupport'; puts ACTIVESUPPORT") - out.should eq('2.3.5') + expect(out).to eq('2.3.5') out = run("require 'thin'; puts THIN") - out.should eq('1.0') + expect(out).to eq('1.0') end it "removes old groups when new groups are set up" do @@ -58,7 +58,7 @@ describe "bundle install with gem sources" do puts THIN RUBY - err.should == "ZOMG LOAD ERROR" + expect(err).to eq("ZOMG LOAD ERROR") end it "sets up old groups when they have previously been removed" do @@ -67,7 +67,7 @@ describe "bundle install with gem sources" do Bundler.setup(:default, :emo) require 'thin'; puts THIN RUBY - out.should == '1.0' + expect(out).to eq('1.0') end end @@ -102,13 +102,13 @@ describe "bundle install with gem sources" do it "does not say it installed gems from the excluded group" do bundle :install, :without => "emo" - out.should_not include("activesupport") + expect(out).not_to include("activesupport") end it "allows Bundler.setup for specific groups" do bundle :install, :without => "emo" run("require 'rack'; puts RACK", :default) - out.should == '1.0.0' + expect(out).to eq('1.0.0') end it "does not effect the resolve" do @@ -138,7 +138,7 @@ describe "bundle install with gem sources" do ENV["BUNDLE_WITHOUT"] = "emo" bundle :install - out.should_not include("activesupport") + expect(out).not_to include("activesupport") should_be_installed "rack 1.0.0", :groups => [:default] should_not_be_installed "activesupport 2.3.5", :groups => [:default] diff --git a/spec/install/gems/packed_spec.rb b/spec/install/gems/packed_spec.rb index 592221226f..cce3b4ab26 100644 --- a/spec/install/gems/packed_spec.rb +++ b/spec/install/gems/packed_spec.rb @@ -44,7 +44,7 @@ describe "bundle install with gem sources" do end bundle :install - err.should be_empty + expect(err).to be_empty should_be_installed "rack 1.0" end @@ -65,7 +65,7 @@ describe "bundle install with gem sources" do gem "platform_specific" G run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" - out.should == "1.0.0 RUBY" + expect(out).to eq("1.0.0 RUBY") end end @@ -75,10 +75,10 @@ describe "bundle install with gem sources" do gem "rack" G bundled_app("vendor/cache").mkpath - bundled_app("vendor/cache").children.should be_empty + expect(bundled_app("vendor/cache").children).to be_empty bundle "install --no-cache" - bundled_app("vendor/cache").children.should be_empty + expect(bundled_app("vendor/cache").children).to be_empty end end end diff --git a/spec/install/gems/platform_spec.rb b/spec/install/gems/platform_spec.rb index b604bc1d7f..281ebf500d 100644 --- a/spec/install/gems/platform_spec.rb +++ b/spec/install/gems/platform_spec.rb @@ -96,7 +96,7 @@ describe "bundle install across platforms" do bundle "install --path vendor/bundle" - vendored_gems("gems/rack-1.0.0").should exist + expect(vendored_gems("gems/rack-1.0.0")).to exist end it "works after switching Rubies" do @@ -112,7 +112,7 @@ describe "bundle install across platforms" do FileUtils.mv(vendored_gems, bundled_app("vendor/bundle/#{Gem.ruby_engine}/#{new_version}")) bundle "install --path ./vendor/bundle" - vendored_gems("gems/rack-1.0.0").should exist + expect(vendored_gems("gems/rack-1.0.0")).to exist end end @@ -186,7 +186,7 @@ describe "bundle install with platform conditionals" do G bundle :show, :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end end diff --git a/spec/install/gems/post_install_spec.rb b/spec/install/gems/post_install_spec.rb index 7a4d56cb59..f7cad665e1 100644 --- a/spec/install/gems/post_install_spec.rb +++ b/spec/install/gems/post_install_spec.rb @@ -11,12 +11,12 @@ describe 'bundle install with gem sources' do G bundle :install - out.should include("Post-install message from rack:") - out.should include("Rack's post install message") - out.should include("Post-install message from thin:") - out.should include("Thin's post install message") - out.should include("Post-install message from rack-obama:") - out.should include("Rack-obama's post install message") + expect(out).to include("Post-install message from rack:") + expect(out).to include("Rack's post install message") + expect(out).to include("Post-install message from thin:") + expect(out).to include("Thin's post install message") + expect(out).to include("Post-install message from rack-obama:") + expect(out).to include("Rack-obama's post install message") end end @@ -28,7 +28,7 @@ describe 'bundle install with gem sources' do G bundle :install - out.should_not include("Post-install message") + expect(out).not_to include("Post-install message") end end @@ -40,8 +40,8 @@ describe 'bundle install with gem sources' do G bundle :install - out.should include("Post-install message from rack:") - out.should include("Rack's post install message") + expect(out).to include("Post-install message from rack:") + expect(out).to include("Rack's post install message") end end end diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index 67b9b2f928..b66d50b6a1 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -16,7 +16,7 @@ describe "bundle install with gem sources" do puts IMPLICIT_RAKE_DEP puts ANOTHER_IMPLICIT_RAKE_DEP R - out.should == "YES\nYES" + expect(out).to eq("YES\nYES") end it "installs gems with a dependency with no type" do @@ -69,4 +69,4 @@ describe "bundle install with gem sources" do end end end -end
\ No newline at end of file +end diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb index 1c932f1738..0208231f5e 100644 --- a/spec/install/gems/simple_case_spec.rb +++ b/spec/install/gems/simple_case_spec.rb @@ -8,7 +8,7 @@ describe "bundle install with gem sources" do G bundle :install - out.should =~ /no dependencies/ + expect(out).to match(/no dependencies/) end it "does not make a lockfile if the install fails" do @@ -16,8 +16,8 @@ describe "bundle install with gem sources" do raise StandardError, "FAIL" G - err.should =~ /FAIL \(StandardError\)/ - bundled_app("Gemfile.lock").should_not exist + expect(err).to match(/FAIL \(StandardError\)/) + expect(bundled_app("Gemfile.lock")).not_to exist end it "creates a Gemfile.lock" do @@ -26,7 +26,7 @@ describe "bundle install with gem sources" do gem "rack" G - bundled_app('Gemfile.lock').should exist + expect(bundled_app('Gemfile.lock')).to exist end it "creates lock files based on the Gemfile name" do @@ -37,7 +37,7 @@ describe "bundle install with gem sources" do bundle 'install --gemfile OmgFile' - bundled_app("OmgFile.lock").should exist + expect(bundled_app("OmgFile.lock")).to exist end it "doesn't delete the lockfile if one already exists" do @@ -52,7 +52,7 @@ describe "bundle install with gem sources" do raise StandardError, "FAIL" G - File.read(bundled_app("Gemfile.lock")).should == lockfile + expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile) end it "does not touch the lockfile if nothing changed" do @@ -61,7 +61,7 @@ describe "bundle install with gem sources" do gem "rack" G - lambda { run '1' }.should_not change { File.mtime(bundled_app('Gemfile.lock')) } + expect { run '1' }.not_to change { File.mtime(bundled_app('Gemfile.lock')) } end it "fetches gems" do @@ -70,7 +70,7 @@ describe "bundle install with gem sources" do gem 'rack' G - default_bundle_path("gems/rack-1.0.0").should exist + expect(default_bundle_path("gems/rack-1.0.0")).to exist should_be_installed("rack 1.0.0") end @@ -80,7 +80,7 @@ describe "bundle install with gem sources" do gem 'rack', "> 0.9", "< 1.0" G - default_bundle_path("gems/rack-0.9.1").should exist + expect(default_bundle_path("gems/rack-0.9.1")).to exist should_be_installed("rack 0.9.1") end @@ -90,7 +90,7 @@ describe "bundle install with gem sources" do gem 'rack', "< 1.0", "> 0.9" G - default_bundle_path("gems/rack-0.9.1").should exist + expect(default_bundle_path("gems/rack-0.9.1")).to exist should_be_installed("rack 0.9.1") end @@ -99,7 +99,7 @@ describe "bundle install with gem sources" do source "file://#{gem_repo1}" gem :rack G - status.should == 4 + expect(status).to eq(4) end it "pulls in dependencies" do @@ -204,7 +204,7 @@ describe "bundle install with gem sources" do G run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" - out.should == "1.0.0 #{Gem::Platform.local}" + expect(out).to eq("1.0.0 #{Gem::Platform.local}") end it "falls back on plain ruby" do @@ -215,7 +215,7 @@ describe "bundle install with gem sources" do G run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" - out.should == "1.0.0 RUBY" + expect(out).to eq("1.0.0 RUBY") end it "installs gems for java" do @@ -226,7 +226,7 @@ describe "bundle install with gem sources" do G run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" - out.should == "1.0.0 JAVA" + expect(out).to eq("1.0.0 JAVA") end it "installs gems for windows" do @@ -238,7 +238,7 @@ describe "bundle install with gem sources" do G run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" - out.should == "1.0.0 MSWIN" + expect(out).to eq("1.0.0 MSWIN") end end @@ -291,14 +291,14 @@ describe "bundle install with gem sources" do G bundle :install, :expect_err => true - out.should =~ /Your Gemfile has no remote sources/i + expect(out).to match(/Your Gemfile has no remote sources/i) end it "creates a Gemfile.lock on a blank Gemfile" do install_gemfile <<-G G - File.exists?(bundled_app("Gemfile.lock")).should be_true + expect(File.exists?(bundled_app("Gemfile.lock"))).to be_true end it "gracefully handles error when rubygems server is unavailable" do @@ -310,8 +310,8 @@ describe "bundle install with gem sources" do G bundle :install - out.should include("Could not reach http://localhost:9384/") - out.should_not include("file://") + expect(out).to include("Could not reach http://localhost:9384/") + expect(out).not_to include("file://") end it "doesn't blow up when the local .bundle/config is empty" do @@ -323,7 +323,7 @@ describe "bundle install with gem sources" do gem 'foo' G - exitstatus.should == 0 + expect(exitstatus).to eq(0) end it "doesn't blow up when the global .bundle/config is empty" do @@ -335,7 +335,7 @@ describe "bundle install with gem sources" do gem 'foo' G - exitstatus.should == 0 + expect(exitstatus).to eq(0) end end @@ -358,7 +358,7 @@ describe "bundle install with gem sources" do bundle :install, :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end end @@ -425,8 +425,8 @@ describe "bundle install with gem sources" do set_bundle_path(type, bundled_app("vendor2").to_s) bundle "install --path vendor/bundle" - vendored_gems("gems/rack-1.0.0").should be_directory - bundled_app("vendor2").should_not be_directory + expect(vendored_gems("gems/rack-1.0.0")).to be_directory + expect(bundled_app("vendor2")).not_to be_directory should_be_installed "rack 1.0.0" end @@ -435,7 +435,7 @@ describe "bundle install with gem sources" do bundle :install - bundled_app('vendor/gems/rack-1.0.0').should be_directory + expect(bundled_app('vendor/gems/rack-1.0.0')).to be_directory should_be_installed "rack 1.0.0" end @@ -447,7 +447,7 @@ describe "bundle install with gem sources" do bundle :install end - bundled_app('vendor/gems/rack-1.0.0').should be_directory + expect(bundled_app('vendor/gems/rack-1.0.0')).to be_directory should_be_installed "rack 1.0.0" end end @@ -457,14 +457,14 @@ describe "bundle install with gem sources" do bundle :install - vendored_gems('gems/rack-1.0.0').should be_directory + expect(vendored_gems('gems/rack-1.0.0')).to be_directory should_be_installed "rack 1.0.0" end it "sets BUNDLE_PATH as the first argument to bundle install" do bundle "install --path ./vendor/bundle" - vendored_gems('gems/rack-1.0.0').should be_directory + expect(vendored_gems('gems/rack-1.0.0')).to be_directory should_be_installed "rack 1.0.0" end @@ -473,7 +473,7 @@ describe "bundle install with gem sources" do build_gem "rack", "1.1.0", :to_system => true bundle "install --path ./vendor/bundle" - vendored_gems('gems/rack-1.0.0').should be_directory + expect(vendored_gems('gems/rack-1.0.0')).to be_directory should_be_installed "rack 1.0.0" end end @@ -500,7 +500,7 @@ describe "bundle install with gem sources" do G bundle :install, :quiet => true - out.should == "" + expect(out).to eq("") end it "should still display warnings" do @@ -509,7 +509,7 @@ describe "bundle install with gem sources" do G bundle :install, :quiet => true - out.should =~ /Your Gemfile has no remote sources/ + expect(out).to match(/Your Gemfile has no remote sources/) end end @@ -528,9 +528,9 @@ describe "bundle install with gem sources" do it "behaves like bundle install vendor/bundle with --deployment" do bundle "install" bundle "install --deployment" - out.should include("It was installed into ./vendor/bundle") + expect(out).to include("It was installed into ./vendor/bundle") should_be_installed "rack 1.0.0" - bundled_app("vendor/bundle").should exist + expect(bundled_app("vendor/bundle")).to exist end it "does not use available system gems with bundle --path vendor/bundle" do @@ -544,7 +544,7 @@ describe "bundle install with gem sources" do Dir.chdir(dir) do bundle "install --path vendor/bundle" - out.should include("installed into ./vendor/bundle") + expect(out).to include("installed into ./vendor/bundle") end dir.rmtree @@ -552,12 +552,12 @@ describe "bundle install with gem sources" do it "prints a warning to let the user know what has happened with bundle --path vendor/bundle" do bundle "install --path vendor/bundle" - out.should include("It was installed into ./vendor") + expect(out).to include("It was installed into ./vendor") end it "disallows --path vendor/bundle --system" do bundle "install --path vendor/bundle --system" - out.should include("Please choose.") + expect(out).to include("Please choose.") end it "remembers to disable system gems after the first time with bundle --path vendor/bundle" do @@ -565,7 +565,7 @@ describe "bundle install with gem sources" do FileUtils.rm_rf bundled_app('vendor') bundle "install" - vendored_gems('gems/rack-1.0.0').should be_directory + expect(vendored_gems('gems/rack-1.0.0')).to be_directory should_be_installed "rack 1.0.0" end end @@ -590,8 +590,8 @@ describe "bundle install with gem sources" do end R - out.should include("1.0") - out.should include("no activesupport") + expect(out).to include("1.0") + expect(out).to include("no activesupport") end end @@ -608,7 +608,7 @@ describe "bundle install with gem sources" do gem "yaml_spec" G bundle :install - err.should be_empty + expect(err).to be_empty end it "still installs correctly when using path" do @@ -617,7 +617,7 @@ describe "bundle install with gem sources" do install_gemfile <<-G gem 'yaml_spec', :path => "#{lib_path('yaml_spec-1.0')}" G - err.should == "" + expect(err).to eq("") end end @@ -665,7 +665,7 @@ describe "bundle install with gem sources" do Current Bundler version: bundler (#{Bundler::VERSION}) E - out.should include(nice_error) + expect(out).to include(nice_error) end it "works for gems with multiple versions in its dependencies" do @@ -693,7 +693,7 @@ describe "bundle install with gem sources" do G run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError; puts 'FAIL'; end" - out.should == "WIN" + expect(out).to eq("WIN") end it "allows gem 'bundler' when Bundler is not in the Gemfile or its dependencies" do @@ -703,7 +703,7 @@ describe "bundle install with gem sources" do G run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError => e; puts e.backtrace; end" - out.should == "WIN" + expect(out).to eq("WIN") end it "causes a conflict if child dependencies conflict" do @@ -723,7 +723,7 @@ describe "bundle install with gem sources" do rails_fail (>= 0) ruby depends on activesupport (1.2.3) E - out.should == nice_error + expect(out).to eq(nice_error) end it "causes a conflict if a child dependency conflicts with the Gemfile" do @@ -742,7 +742,7 @@ describe "bundle install with gem sources" do activesupport (2.3.5) E - out.should == nice_error + expect(out).to eq(nice_error) end it "can install dependencies even if " do @@ -755,7 +755,7 @@ describe "bundle install with gem sources" do #simulate_new_machine bundle "check" - out.should == "The Gemfile's dependencies are satisfied" + expect(out).to eq("The Gemfile's dependencies are satisfied") end end @@ -788,7 +788,7 @@ describe "bundle install with gem sources" do it "does not hit the remote a second time" do FileUtils.rm_rf gem_repo2 bundle "install --without rack" - err.should be_empty + expect(err).to be_empty end end @@ -796,7 +796,7 @@ describe "bundle install with gem sources" do # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if # you want to avoid sudo installs for system gems with OS X's default ruby it "overrides Gem.bindir" do - Pathname.new("/usr/bin").should_not be_writable unless Process::euid == 0 + expect(Pathname.new("/usr/bin")).not_to be_writable unless Process::euid == 0 gemfile <<-G require 'rubygems' def Gem.bindir; "/usr/bin"; end @@ -807,7 +807,7 @@ describe "bundle install with gem sources" do config "BUNDLE_SYSTEM_BINDIR" => system_gem_path('altbin').to_s bundle :install should_be_installed "rack 1.0.0" - system_gem_path("altbin/rackup").should exist + expect(system_gem_path("altbin/rackup")).to exist end end diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index 9e3ad402f9..c666120ad4 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -14,7 +14,7 @@ describe "bundle install --standalone" do end it "generates a bundle/bundler/setup.rb" do - bundled_app("bundle/bundler/setup.rb").should exist + expect(bundled_app("bundle/bundler/setup.rb")).to exist end it "makes the gems available without bundler" do @@ -26,7 +26,7 @@ describe "bundle install --standalone" do puts ACTIONPACK RUBY - out.should be == "2.3.2" + expect(out).to eq("2.3.2") end it "works on a different system" do @@ -41,7 +41,7 @@ describe "bundle install --standalone" do puts ACTIONPACK RUBY - out.should be == "2.3.2" + expect(out).to eq("2.3.2") end end @@ -61,7 +61,7 @@ describe "bundle install --standalone" do end it "generates a bundle/bundler/setup.rb" do - bundled_app("bundle/bundler/setup.rb").should exist + expect(bundled_app("bundle/bundler/setup.rb")).to exist end it "makes the gems available without bundler" do @@ -75,7 +75,7 @@ describe "bundle install --standalone" do puts ACTIONPACK RUBY - out.should be == "1.0\n2.3.2" + expect(out).to eq("1.0\n2.3.2") end end @@ -107,7 +107,7 @@ describe "bundle install --standalone" do puts RACK_TEST RUBY - out.should be == "2.3.2\n1.2.7\n1.0" + expect(out).to eq("2.3.2\n1.2.7\n1.0") end it "allows creating a standalone file with limited groups" do @@ -122,8 +122,8 @@ describe "bundle install --standalone" do require "spec" RUBY - out.should be == "2.3.2" - err.should == "ZOMG LOAD ERROR" + expect(out).to eq("2.3.2") + expect(err).to eq("ZOMG LOAD ERROR") end it "allows --without to limit the groups used in a standalone" do @@ -138,8 +138,8 @@ describe "bundle install --standalone" do require "spec" RUBY - out.should be == "2.3.2" - err.should == "ZOMG LOAD ERROR" + expect(out).to eq("2.3.2") + expect(err).to eq("ZOMG LOAD ERROR") end it "allows --path to change the location of the standalone bundle" do @@ -153,7 +153,7 @@ describe "bundle install --standalone" do puts ACTIONPACK RUBY - out.should == "2.3.2" + expect(out).to eq("2.3.2") end it "allows remembered --without to limit the groups used in a standalone" do @@ -169,8 +169,8 @@ describe "bundle install --standalone" do require "spec" RUBY - out.should be == "2.3.2" - err.should == "ZOMG LOAD ERROR" + expect(out).to eq("2.3.2") + expect(err).to eq("ZOMG LOAD ERROR") end end @@ -188,7 +188,7 @@ describe "bundle install --standalone" do it "should run without errors" do bundle "install --standalone", :artifice => "endpoint", :exitstatus => true - @exitstatus.should be == 0 + expect(@exitstatus).to eq(0) end it "still makes the gems available to normal bundler" do @@ -200,7 +200,7 @@ describe "bundle install --standalone" do it "generates a bundle/bundler/setup.rb" do bundle "install --standalone", :artifice => "endpoint" - bundled_app("bundle/bundler/setup.rb").should exist + expect(bundled_app("bundle/bundler/setup.rb")).to exist end it "makes the gems available without bundler" do @@ -214,7 +214,7 @@ describe "bundle install --standalone" do puts ACTIONPACK RUBY - out.should be == "2.3.2" + expect(out).to eq("2.3.2") end it "works on a different system" do @@ -231,7 +231,7 @@ describe "bundle install --standalone" do puts ACTIONPACK RUBY - out.should be == "2.3.2" + expect(out).to eq("2.3.2") end end end @@ -246,14 +246,14 @@ describe "bundle install --standalone" do it "creates stubs that use the standalone load path" do Dir.chdir(bundled_app) do - `bin/rails -v`.chomp.should eql "2.3.2" + expect(`bin/rails -v`.chomp).to eql "2.3.2" end end it "creates stubs that can be executed from anywhere" do require 'tmpdir' Dir.chdir(Dir.tmpdir) do - `#{bundled_app}/bin/rails -v`.chomp.should eql "2.3.2" + expect(`#{bundled_app}/bin/rails -v`.chomp).to eql "2.3.2" end end end diff --git a/spec/install/gems/sudo_spec.rb b/spec/install/gems/sudo_spec.rb index 3894f76811..32738aacb7 100644 --- a/spec/install/gems/sudo_spec.rb +++ b/spec/install/gems/sudo_spec.rb @@ -13,8 +13,8 @@ describe "when using sudo", :sudo => true do gem "thin" G - system_gem_path("gems/rack-1.0.0").should exist - system_gem_path("gems/rack-1.0.0").stat.uid.should eq(0) + expect(system_gem_path("gems/rack-1.0.0")).to exist + expect(system_gem_path("gems/rack-1.0.0").stat.uid).to eq(0) should_be_installed "rack 1.0" end @@ -29,8 +29,8 @@ describe "when using sudo", :sudo => true do gem "rack", '1.0' G - bundle_path.join("gems/rack-1.0.0").should exist - bundle_path.join("gems/rack-1.0.0").stat.uid.should eq(0) + expect(bundle_path.join("gems/rack-1.0.0")).to exist + expect(bundle_path.join("gems/rack-1.0.0").stat.uid).to eq(0) should_be_installed "rack 1.0" end @@ -45,7 +45,7 @@ describe "when using sudo", :sudo => true do gem "rack", '1.0' G - default_bundle_path("gems/rack-1.0.0").should exist + expect(default_bundle_path("gems/rack-1.0.0")).to exist should_be_installed "rack 1.0" end end @@ -65,7 +65,7 @@ describe "when using sudo", :sudo => true do gem "rack", '1.0' G - gem_home.join('bin/rackup').should exist + expect(gem_home.join('bin/rackup')).to exist should_be_installed "rack 1.0" end end diff --git a/spec/install/gems/win32_spec.rb b/spec/install/gems/win32_spec.rb index 59adb18324..771d3faa4a 100644 --- a/spec/install/gems/win32_spec.rb +++ b/spec/install/gems/win32_spec.rb @@ -21,6 +21,6 @@ describe "bundle install with win32-generated lockfile" do gem "rack" G - @exitstatus.should == 0 + expect(@exitstatus).to eq(0) end end diff --git a/spec/install/gemspec_spec.rb b/spec/install/gemspec_spec.rb index 7000d765a6..a8d0f3d323 100644 --- a/spec/install/gemspec_spec.rb +++ b/spec/install/gemspec_spec.rb @@ -62,7 +62,7 @@ describe "bundle install from an existing gemspec" do source "file://#{gem_repo2}" gemspec :path => '#{tmp.join("foo")}' G - error.should match(/There are no gemspecs at #{tmp.join('foo')}/) + expect(error).to match(/There are no gemspecs at #{tmp.join('foo')}/) end it "should raise if there are too many gemspecs available" do @@ -74,7 +74,7 @@ describe "bundle install from an existing gemspec" do source "file://#{gem_repo2}" gemspec :path => '#{tmp.join("foo")}' G - error.should match(/There are multiple gemspecs at #{tmp.join('foo')}/) + expect(error).to match(/There are multiple gemspecs at #{tmp.join('foo')}/) end it "should pick a specific gemspec" do @@ -125,9 +125,9 @@ describe "bundle install from an existing gemspec" do # doesn't change. Exit codes should be used correctly (they can be more # than just 0 and 1). output = bundle("install --deployment") - output.should_not match(/You have added to the Gemfile/) - output.should_not match(/You have deleted from the Gemfile/) - output.should_not match(/install in deployment mode after changing/) + expect(output).not_to match(/You have added to the Gemfile/) + expect(output).not_to match(/You have deleted from the Gemfile/) + expect(output).not_to match(/install in deployment mode after changing/) end end @@ -140,7 +140,7 @@ describe "bundle install from an existing gemspec" do install_gemfile <<-G, :expect_err => true gemspec :path => '#{tmp.join("foo")}' G - @err.should_not match(/ahh/) + expect(@err).not_to match(/ahh/) end context "when child gemspecs conflict with a released gemspec" do diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index bacfdbd14e..305445630e 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -23,11 +23,11 @@ describe "bundle install with git sources" do puts "WIN" unless defined?(FOO_PREV_REF) RUBY - out.should == "WIN" + expect(out).to eq("WIN") end it "caches the git repo" do - Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"].should have(1).item + expect(Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"]).to have(1).item end it "does not update the git source implicitly" do @@ -47,14 +47,14 @@ describe "bundle install with git sources" do puts "fail" if defined?(FOO_PREV_REF) RUBY - out.should be_empty + expect(out).to be_empty end end it "setups executables" do pending_jruby_shebang_fix bundle "exec foobar" - out.should == "1.0" + expect(out).to eq("1.0") end it "complains if pinned specs don't exist in the git repo" do @@ -64,7 +64,7 @@ describe "bundle install with git sources" do gem "foo", "1.1", :git => "#{lib_path('foo-1.0')}" G - out.should include("Source contains 'foo' at: 1.0") + expect(out).to include("Source contains 'foo' at: 1.0") end it "still works after moving the application directory" do @@ -136,7 +136,7 @@ describe "bundle install with git sources" do puts "WIN" unless defined?(FOO_PREV_REF) RUBY - out.should == "WIN" + expect(out).to eq("WIN") end it "works when the revision is a symbol" do @@ -145,14 +145,14 @@ describe "bundle install with git sources" do gem "foo" end G - err.should eq("") + expect(err).to eq("") run <<-RUBY require 'foo' puts "WIN" unless defined?(FOO_PREV_REF) RUBY - out.should == "WIN" + expect(out).to eq("WIN") end end @@ -172,10 +172,10 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /at #{lib_path('local-rack')}/ + expect(out).to match(/at #{lib_path('local-rack')}/) run "require 'rack'" - out.should == "LOCAL" + expect(out).to eq("LOCAL") end it "chooses the local repository on runtime" do @@ -194,7 +194,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| run "require 'rack'" - out.should == "LOCAL" + expect(out).to eq("LOCAL") end it "updates specs on runtime" do @@ -218,7 +218,7 @@ describe "bundle install with git sources" do run "require 'rack'" lockfile1 = File.read(bundled_app("Gemfile.lock")) - lockfile1.should_not == lockfile0 + expect(lockfile1).not_to eq(lockfile0) end it "updates ref on install" do @@ -238,7 +238,7 @@ describe "bundle install with git sources" do bundle :install lockfile1 = File.read(bundled_app("Gemfile.lock")) - lockfile1.should_not == lockfile0 + expect(lockfile1).not_to eq(lockfile0) end it "explodes if given path does not exist on install" do @@ -251,7 +251,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/ + expect(out).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/) end it "explodes if branch is not given on install" do @@ -265,7 +265,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /cannot use local override/i + expect(out).to match(/cannot use local override/i) end it "does not explode if disable_local_branch_check is given" do @@ -280,7 +280,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle %|config disable_local_branch_check true| bundle :install - out.should =~ /Your bundle is complete!/ + expect(out).to match(/Your bundle is complete!/) end it "explodes on different branches on install" do @@ -299,7 +299,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /is using branch another but Gemfile specifies master/ + expect(out).to match(/is using branch another but Gemfile specifies master/) end it "explodes on invalid revision on install" do @@ -316,7 +316,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /The Gemfile lock is pointing to revision \w+/ + expect(out).to match(/The Gemfile lock is pointing to revision \w+/) end end @@ -365,7 +365,7 @@ describe "bundle install with git sources" do G run "require 'rack'" - out.should == 'WIN OVERRIDE' + expect(out).to eq('WIN OVERRIDE') end it "correctly unlocks when changing to a git source" do @@ -431,7 +431,7 @@ describe "bundle install with git sources" do puts "WIN" unless defined?(FOO_PREV_REF) RUBY - out.should == "WIN" + expect(out).to eq("WIN") end it "correctly handles cases with invalid gemspecs" do @@ -512,9 +512,9 @@ describe "bundle install with git sources" do bundle :install, :expect_err => true - out.should include("Git error:") - err.should include("fatal") - err.should include("omgomg") + expect(out).to include("Git error:") + expect(err).to include("fatal") + expect(err).to include("omgomg") end it "works when the gem path has spaces in it" do @@ -567,7 +567,7 @@ describe "bundle install with git sources" do gem "has_submodule" end G - out.should =~ /could not find gem 'submodule/i + expect(out).to match(/could not find gem 'submodule/i) should_not_be_installed "has_submodule 1.0", :expect_err => true end @@ -614,7 +614,7 @@ describe "bundle install with git sources" do puts "WIN" if FOO_PREV_REF == '#{git.ref_for("HEAD^^")}' RUBY - out.should == "WIN" + expect(out).to eq("WIN") end it "does not to a remote fetch if the revision is cached locally" do @@ -627,7 +627,7 @@ describe "bundle install with git sources" do FileUtils.rm_rf(lib_path('foo-1.0')) bundle "install" - out.should_not =~ /updating/i + expect(out).not_to match(/updating/i) end it "doesn't blow up if bundle install is run twice in a row" do @@ -639,7 +639,7 @@ describe "bundle install with git sources" do bundle "install" bundle "install", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end it "does not duplicate git gem sources" do @@ -655,7 +655,7 @@ describe "bundle install with git sources" do G bundle "install" - File.read(bundled_app("Gemfile.lock")).scan('GIT').size.should == 1 + expect(File.read(bundled_app("Gemfile.lock")).scan('GIT').size).to eq(1) end describe "switching sources" do @@ -699,7 +699,7 @@ describe "bundle install with git sources" do G run "require 'new_file'" - out.should == "USING GIT" + expect(out).to eq("USING GIT") end end @@ -727,7 +727,7 @@ describe "bundle install with git sources" do puts VALIM_PREV_REF R - out.should == old_revision + expect(out).to eq(old_revision) end end @@ -743,7 +743,7 @@ describe "bundle install with git sources" do simulate_new_machine bundle "install --deployment", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end end @@ -765,7 +765,7 @@ describe "bundle install with git sources" do bundle :install, :expect_err => true, :requires => [lib_path('install_hooks.rb')] - err.should == "Ran pre-install hook: foo-1.0" + expect(err).to eq("Ran pre-install hook: foo-1.0") end it "runs post-install hooks" do @@ -785,7 +785,7 @@ describe "bundle install with git sources" do bundle :install, :expect_err => true, :requires => [lib_path('install_hooks.rb')] - err.should == "Ran post-install hook: foo-1.0" + expect(err).to eq("Ran post-install hook: foo-1.0") end it "complains if the install hook fails" do @@ -805,7 +805,7 @@ describe "bundle install with git sources" do bundle :install, :expect_err => true, :requires => [lib_path('install_hooks.rb')] - out.should include("failed for foo-1.0") + expect(out).to include("failed for foo-1.0") end end end diff --git a/spec/install/invalid_spec.rb b/spec/install/invalid_spec.rb index 67b6d31a8d..fbf41bf419 100644 --- a/spec/install/invalid_spec.rb +++ b/spec/install/invalid_spec.rb @@ -11,7 +11,7 @@ describe "bundle install with deprecated features" do G bundle :install - out.should =~ /You passed :lib as an option for gem 'rack', but it is invalid/ + expect(out).to match(/You passed :lib as an option for gem 'rack', but it is invalid/) end end @@ -30,6 +30,6 @@ describe "bundle install to a dead symlink" do G bundle "install --path bundle" - out.should =~ /invalid symlink/ + expect(out).to match(/invalid symlink/) end -end
\ No newline at end of file +end diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 8b778d4efe..544e44326c 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -67,7 +67,7 @@ describe "bundle install with explicit source paths" do G bundle "install --frozen", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end it "installs dependencies from the path even if a newer gem is available elsewhere" do @@ -87,7 +87,7 @@ describe "bundle install with explicit source paths" do G run "require 'rack'" - out.should == 'WIN OVERRIDE' + expect(out).to eq('WIN OVERRIDE') end it "works" do @@ -191,8 +191,8 @@ describe "bundle install with explicit source paths" do gemspec :path => "#{lib_path("foo")}" G - exitstatus.should eq(15) - out.should =~ /There are multiple gemspecs/ + expect(exitstatus).to eq(15) + expect(out).to match(/There are multiple gemspecs/) end it "allows :name to be specified to resolve ambiguity" do @@ -220,7 +220,7 @@ describe "bundle install with explicit source paths" do G bundle "exec foobar" - out.should == "1.0" + expect(out).to eq("1.0") end it "handles directories in bin/" do @@ -231,7 +231,7 @@ describe "bundle install with explicit source paths" do install_gemfile <<-G gem 'foo', '1.0', :path => "#{lib_path('foo-1.0')}" G - err.should == "" + expect(err).to eq("") end it "removes the .gem file after installing" do @@ -241,7 +241,7 @@ describe "bundle install with explicit source paths" do gem 'foo', :path => "#{lib_path('foo-1.0')}" G - lib_path('foo-1.0').join('foo-1.0.gem').should_not exist + expect(lib_path('foo-1.0').join('foo-1.0.gem')).not_to exist end describe "block syntax" do @@ -297,7 +297,7 @@ describe "bundle install with explicit source paths" do G bundle "exec foo" - out.should == "1.0" + expect(out).to eq("1.0") end describe "when the gem version in the path is updated" do diff --git a/spec/install/upgrade_spec.rb b/spec/install/upgrade_spec.rb index 67d8eebf54..603c39bf11 100644 --- a/spec/install/upgrade_spec.rb +++ b/spec/install/upgrade_spec.rb @@ -13,14 +13,14 @@ describe "bundle install for the first time with v1.0" do it "removes lockfiles in 0.9 YAML format" do File.open("Gemfile.lock", "w"){|f| YAML.dump({}, f) } bundle :install - File.read("Gemfile.lock").should_not =~ /^---/ + expect(File.read("Gemfile.lock")).not_to match(/^---/) end it "removes env.rb if it exists" do bundled_app.join(".bundle").mkdir bundled_app.join(".bundle/environment.rb").open("w"){|f| f.write("raise 'nooo'") } bundle :install - bundled_app.join(".bundle/environment.rb").should_not exist + expect(bundled_app.join(".bundle/environment.rb")).not_to exist end end diff --git a/spec/integration/inject.rb b/spec/integration/inject.rb index e57eeb0347..f7ffff6083 100644 --- a/spec/integration/inject.rb +++ b/spec/integration/inject.rb @@ -10,9 +10,9 @@ describe "bundle inject" do context "without a lockfile" do it "locks with the injected gems" do - bundled_app("Gemfile.lock").should_not exist + expect(bundled_app("Gemfile.lock")).not_to exist bundle "inject 'rack-obama' '> 0'" - bundled_app("Gemfile.lock").read.should match(/rack-obama/) + expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/) end end @@ -22,22 +22,22 @@ describe "bundle inject" do end it "adds the injected gems to the gemfile" do - bundled_app("Gemfile").read.should_not match(/rack-obama/) + expect(bundled_app("Gemfile").read).not_to match(/rack-obama/) bundle "inject 'rack-obama' '> 0'" - bundled_app("Gemfile").read.should match(/rack-obama/) + expect(bundled_app("Gemfile").read).to match(/rack-obama/) end it "locks with the injected gems" do - bundled_app("Gemfile.lock").read.should_not match(/rack-obama/) + expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/) bundle "inject 'rack-obama' '> 0'" - bundled_app("Gemfile.lock").read.should match(/rack-obama/) + expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/) end end context "with injected gems already in the Gemfile" do it "doesn't add existing gems" do bundle "inject 'rack' '> 0'" - out.should match(/cannot specify the same gem twice/i) + expect(out).to match(/cannot specify the same gem twice/i) end end @@ -49,19 +49,19 @@ describe "bundle inject" do it "injects anyway" do bundle "inject 'rack-obama' '> 0'" - bundled_app("Gemfile").read.should match(/rack-obama/) + expect(bundled_app("Gemfile").read).to match(/rack-obama/) end it "locks with the injected gems" do - bundled_app("Gemfile.lock").read.should_not match(/rack-obama/) + expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/) bundle "inject 'rack-obama' '> 0'" - bundled_app("Gemfile.lock").read.should match(/rack-obama/) + expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/) end it "restores frozen afterwards" do bundle "inject 'rack-obama' '> 0'" config = YAML.load(bundled_app(".bundle/config").read) - config["BUNDLE_FROZEN"].should == "1" + expect(config["BUNDLE_FROZEN"]).to eq("1") end it "doesn't allow Gemfile changes" do @@ -70,9 +70,9 @@ describe "bundle inject" do gem "rack-obama" G bundle "inject 'rack' '> 0'" - out.should match(/trying to install in deployment mode after changing/) + expect(out).to match(/trying to install in deployment mode after changing/) - bundled_app("Gemfile.lock").read.should_not match(/rack-obama/) + expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/) end end -end
\ No newline at end of file +end diff --git a/spec/lock/git_spec.rb b/spec/lock/git_spec.rb index 7d023b83d2..23b7f3112c 100644 --- a/spec/lock/git_spec.rb +++ b/spec/lock/git_spec.rb @@ -22,14 +22,14 @@ describe "bundle lock with git gems" do puts "WIN" unless defined?(FOO_PREV_REF) RUBY - out.should == "WIN" + expect(out).to eq("WIN") end it "provides correct #full_gem_path" do run <<-RUBY puts Bundler.rubygems.find_name('foo').first.full_gem_path RUBY - out.should == bundle("show foo") + expect(out).to eq(bundle("show foo")) end end diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 81c5119e94..45173f3bdf 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -633,8 +633,8 @@ describe "the lockfile format" do gem "rack", "1.1" G - bundled_app("Gemfile.lock").should_not exist - out.should include "rack (= 1.0) and rack (= 1.1)" + expect(bundled_app("Gemfile.lock")).not_to exist + expect(out).to include "rack (= 1.0) and rack (= 1.1)" end @@ -645,8 +645,8 @@ describe "the lockfile format" do gem "rack", :git => "git://hubz.com" G - bundled_app("Gemfile.lock").should_not exist - out.should include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)" + expect(bundled_app("Gemfile.lock")).not_to exist + expect(out).to include "rack (>= 0) should come from an unspecified source and git://hubz.com (at master)" end it "works correctly with multiple version dependencies" do @@ -720,7 +720,7 @@ describe "the lockfile format" do should_be_installed "omg 1.0" # Confirm that duplicate specs do not appear - File.read(bundled_app('Gemfile.lock')).should == strip_whitespace(<<-L) + expect(File.read(bundled_app('Gemfile.lock'))).to eq(strip_whitespace(<<-L)) GIT remote: #{lib_path('omg')} revision: #{revision} @@ -755,7 +755,7 @@ describe "the lockfile format" do end it "generates Gemfile.lock with \\n line endings" do - File.read(bundled_app("Gemfile.lock")).should_not match("\r\n") + expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n") should_be_installed "rack 1.0" end @@ -764,8 +764,8 @@ describe "the lockfile format" do it "preserves Gemfile.lock \\n line endings" do update_repo2 - lambda { bundle "update" }.should change { File.mtime(bundled_app('Gemfile.lock')) } - File.read(bundled_app("Gemfile.lock")).should_not match("\r\n") + expect { bundle "update" }.to change { File.mtime(bundled_app('Gemfile.lock')) } + expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n") should_be_installed "rack 1.2" end @@ -775,8 +775,8 @@ describe "the lockfile format" do File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value - lambda { bundle "update" }.should change { File.mtime(bundled_app('Gemfile.lock')) } - File.read(bundled_app("Gemfile.lock")).should match("\r\n") + expect { bundle "update" }.to change { File.mtime(bundled_app('Gemfile.lock')) } + expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n") should_be_installed "rack 1.2" end end @@ -784,12 +784,12 @@ describe "the lockfile format" do context "when nothing changes" do it "preserves Gemfile.lock \\n line endings" do - lambda { ruby <<-RUBY + expect { ruby <<-RUBY require 'rubygems' require 'bundler' Bundler.setup RUBY - }.should_not change { File.mtime(bundled_app('Gemfile.lock')) } + }.not_to change { File.mtime(bundled_app('Gemfile.lock')) } end it "preserves Gemfile.lock \\n\\r line endings" do @@ -797,12 +797,12 @@ describe "the lockfile format" do File.open(bundled_app("Gemfile.lock"), "wb"){|f| f.puts(win_lock) } set_lockfile_mtime_to_known_value - lambda { ruby <<-RUBY + expect { ruby <<-RUBY require 'rubygems' require 'bundler' Bundler.setup RUBY - }.should_not change { File.mtime(bundled_app('Gemfile.lock')) } + }.not_to change { File.mtime(bundled_app('Gemfile.lock')) } end end end diff --git a/spec/other/check_spec.rb b/spec/other/check_spec.rb index 103e615049..068b0f0e77 100644 --- a/spec/other/check_spec.rb +++ b/spec/other/check_spec.rb @@ -8,8 +8,8 @@ describe "bundle check" do G bundle :check, :exitstatus => true - @exitstatus.should eq(0) - out.should == "The Gemfile's dependencies are satisfied" + expect(@exitstatus).to eq(0) + expect(out).to eq("The Gemfile's dependencies are satisfied") end it "works with the --gemfile flag when not in the directory" do @@ -20,7 +20,7 @@ describe "bundle check" do Dir.chdir tmp bundle "check --gemfile bundled_app/Gemfile" - out.should == "The Gemfile's dependencies are satisfied" + expect(out).to eq("The Gemfile's dependencies are satisfied") end it "creates a Gemfile.lock by default if one did not exist" do @@ -33,7 +33,7 @@ describe "bundle check" do bundle "check" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end it "does not create a Gemfile.lock if --dry-run was passed" do @@ -46,7 +46,7 @@ describe "bundle check" do bundle "check --dry-run" - bundled_app("Gemfile.lock").should_not exist + expect(bundled_app("Gemfile.lock")).not_to exist end it "prints a generic error if the missing gems are unresolvable" do @@ -58,7 +58,7 @@ describe "bundle check" do G bundle :check - out.should include("Your Gemfile's dependencies could not be satisfied") + expect(out).to include("Your Gemfile's dependencies could not be satisfied") end it "prints a generic error if a Gemfile.lock does not exist and a toplevel dependency does not exist" do @@ -68,8 +68,8 @@ describe "bundle check" do G bundle :check, :exitstatus => true - @exitstatus.should be > 0 - out.should include("could not be satisfied") + expect(@exitstatus).to be > 0 + expect(out).to include("could not be satisfied") end it "prints a generic message if you changed your lockfile" do @@ -89,7 +89,7 @@ describe "bundle check" do G bundle :check - out.should include("Your Gemfile's dependencies could not be satisfied") + expect(out).to include("Your Gemfile's dependencies could not be satisfied") end it "remembers --without option from install" do @@ -102,8 +102,8 @@ describe "bundle check" do bundle "install --without foo" bundle "check", :exitstatus => true - @exitstatus.should eq(0) - out.should include("The Gemfile's dependencies are satisfied") + expect(@exitstatus).to eq(0) + expect(out).to include("The Gemfile's dependencies are satisfied") end it "ensures that gems are actually installed and not just cached" do @@ -120,8 +120,8 @@ describe "bundle check" do G bundle "check", :exitstatus => true - out.should include("* rack (1.0.0)") - @exitstatus.should == 1 + expect(out).to include("* rack (1.0.0)") + expect(@exitstatus).to eq(1) end it "ignores missing gems restricted to other platforms" do @@ -152,7 +152,7 @@ describe "bundle check" do G bundle :check - out.should == "The Gemfile's dependencies are satisfied" + expect(out).to eq("The Gemfile's dependencies are satisfied") end it "works with env conditionals" do @@ -183,19 +183,19 @@ describe "bundle check" do G bundle :check - out.should == "The Gemfile's dependencies are satisfied" + expect(out).to eq("The Gemfile's dependencies are satisfied") end it "outputs an error when the default Gemfile is not found" do bundle :check, :exitstatus => true - @exitstatus.should eq(10) - out.should include("Could not locate Gemfile") + expect(@exitstatus).to eq(10) + expect(out).to include("Could not locate Gemfile") end it "does not output fatal error message" do bundle :check, :exitstatus => true - @exitstatus.should eq(10) - out.should_not include("Unfortunately, a fatal error has occurred. ") + expect(@exitstatus).to eq(10) + expect(out).not_to include("Unfortunately, a fatal error has occurred. ") end it "should not crash when called multiple times on a new machine" do @@ -209,8 +209,8 @@ describe "bundle check" do last_out = out 3.times do |i| bundle :check - out.should eq(last_out) - err.should be_empty + expect(out).to eq(last_out) + expect(err).to be_empty end end @@ -225,7 +225,7 @@ describe "bundle check" do FileUtils.rm(bundled_app("Gemfile.lock")) bundle :check, :exitstatus => true - exitstatus.should_not eq(0) + expect(exitstatus).not_to eq(0) end context "--path" do @@ -241,14 +241,14 @@ describe "bundle check" do it "returns success" do bundle "check --path vendor/bundle", :exitstatus => true - @exitstatus.should eq(0) - out.should == "The Gemfile's dependencies are satisfied" + expect(@exitstatus).to eq(0) + expect(out).to eq("The Gemfile's dependencies are satisfied") end it "should write to .bundle/config" do bundle "check --path vendor/bundle", :exitstatus => true bundle "check", :exitstatus => true - @exitstatus.should eq(0) + expect(@exitstatus).to eq(0) end end @@ -264,15 +264,15 @@ describe "bundle check" do it "returns success when the Gemfile is satisfied" do bundle :install bundle :check, :exitstatus => true - @exitstatus.should eq(0) - out.should == "The Gemfile's dependencies are satisfied" + expect(@exitstatus).to eq(0) + expect(out).to eq("The Gemfile's dependencies are satisfied") end it "shows what is missing with the current Gemfile if it is not satisfied" do simulate_new_machine bundle :check - out.should match(/The following gems are missing/) - out.should include("* rack (1.0") + expect(out).to match(/The following gems are missing/) + expect(out).to include("* rack (1.0") end end end diff --git a/spec/other/clean_spec.rb b/spec/other/clean_spec.rb index 5a481609ad..8b93f9a719 100644 --- a/spec/other/clean_spec.rb +++ b/spec/other/clean_spec.rb @@ -3,17 +3,17 @@ require "spec_helper" describe "bundle clean" do def should_have_gems(*gems) gems.each do |g| - vendored_gems("gems/#{g}").should exist - vendored_gems("specifications/#{g}.gemspec").should exist - vendored_gems("cache/#{g}.gem").should exist + expect(vendored_gems("gems/#{g}")).to exist + expect(vendored_gems("specifications/#{g}.gemspec")).to exist + expect(vendored_gems("cache/#{g}.gem")).to exist end end def should_not_have_gems(*gems) gems.each do |g| - vendored_gems("gems/#{g}").should_not exist - vendored_gems("specifications/#{g}.gemspec").should_not exist - vendored_gems("cache/#{g}.gem").should_not exist + expect(vendored_gems("gems/#{g}")).not_to exist + expect(vendored_gems("specifications/#{g}.gemspec")).not_to exist + expect(vendored_gems("cache/#{g}.gem")).not_to exist end end @@ -36,12 +36,12 @@ describe "bundle clean" do bundle :clean - out.should eq("Removing foo (1.0)") + expect(out).to eq("Removing foo (1.0)") should_have_gems 'thin-1.0', 'rack-1.0.0' should_not_have_gems 'foo-1.0' - vendored_gems("bin/rackup").should exist + expect(vendored_gems("bin/rackup")).to exist end it "removes old version of gem if unused" do @@ -64,12 +64,12 @@ describe "bundle clean" do bundle :clean - out.should eq("Removing rack (0.9.1)") + expect(out).to eq("Removing rack (0.9.1)") should_have_gems 'foo-1.0', 'rack-1.0.0' should_not_have_gems 'rack-0.9.1' - vendored_gems("bin/rackup").should exist + expect(vendored_gems("bin/rackup")).to exist end it "removes new version of gem if unused" do @@ -92,12 +92,12 @@ describe "bundle clean" do bundle :clean - out.should eq("Removing rack (1.0.0)") + expect(out).to eq("Removing rack (1.0.0)") should_have_gems 'foo-1.0', 'rack-0.9.1' should_not_have_gems 'rack-1.0.0' - vendored_gems("bin/rackup").should exist + expect(vendored_gems("bin/rackup")).to exist end it "does not remove cached git dir if it's being used" do @@ -119,7 +119,7 @@ describe "bundle clean" do bundle :clean digest = Digest::SHA1.hexdigest(git_path.to_s) - vendored_gems("cache/bundler/git/foo-1.0-#{digest}").should exist + expect(vendored_gems("cache/bundler/git/foo-1.0-#{digest}")).to exist end it "removes unused git gems" do @@ -147,16 +147,16 @@ describe "bundle clean" do bundle :clean - out.should eq("Removing foo (#{revision[0..11]})") + expect(out).to eq("Removing foo (#{revision[0..11]})") - vendored_gems("gems/rack-1.0.0").should exist - vendored_gems("bundler/gems/foo-#{revision[0..11]}").should_not exist + expect(vendored_gems("gems/rack-1.0.0")).to exist + expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).not_to exist digest = Digest::SHA1.hexdigest(git_path.to_s) - vendored_gems("cache/bundler/git/foo-#{digest}").should_not exist + expect(vendored_gems("cache/bundler/git/foo-#{digest}")).not_to exist - vendored_gems("specifications/rack-1.0.0.gemspec").should exist + expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist - vendored_gems("bin/rackup").should exist + expect(vendored_gems("bin/rackup")).to exist end it "removes old git gems" do @@ -180,15 +180,15 @@ describe "bundle clean" do bundle "update" bundle :clean - out.should eq("Removing foo-bar (#{revision[0..11]})") + expect(out).to eq("Removing foo-bar (#{revision[0..11]})") - vendored_gems("gems/rack-1.0.0").should exist - vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}").should_not exist - vendored_gems("bundler/gems/foo-bar-#{revision2[0..11]}").should exist + expect(vendored_gems("gems/rack-1.0.0")).to exist + expect(vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}")).not_to exist + expect(vendored_gems("bundler/gems/foo-bar-#{revision2[0..11]}")).to exist - vendored_gems("specifications/rack-1.0.0.gemspec").should exist + expect(vendored_gems("specifications/rack-1.0.0.gemspec")).to exist - vendored_gems("bin/rackup").should exist + expect(vendored_gems("bin/rackup")).to exist end it "does not remove nested gems in a git repo" do @@ -204,9 +204,9 @@ describe "bundle clean" do bundle "install --path vendor/bundle" bundle :clean - out.should eq("") + expect(out).to eq("") - vendored_gems("bundler/gems/rails-#{revision[0..11]}").should exist + expect(vendored_gems("bundler/gems/rails-#{revision[0..11]}")).to exist end it "does not remove git sources that are in without groups" do @@ -228,10 +228,10 @@ describe "bundle clean" do bundle :clean - out.should eq("") - vendored_gems("bundler/gems/foo-#{revision[0..11]}").should exist + expect(out).to eq("") + expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).to exist digest = Digest::SHA1.hexdigest(git_path.to_s) - vendored_gems("cache/bundler/git/foo-#{digest}").should exist + expect(vendored_gems("cache/bundler/git/foo-#{digest}")).to exist end it "displays an error when used without --path" do @@ -243,8 +243,8 @@ describe "bundle clean" do bundle :clean, :exitstatus => true - exitstatus.should eq(1) - out.should == "Can only use bundle clean when --path is set or --force is set" + expect(exitstatus).to eq(1) + expect(out).to eq("Can only use bundle clean when --path is set or --force is set") end # handling bundle clean upgrade path from the pre's @@ -274,7 +274,7 @@ describe "bundle clean" do should_not_have_gems 'thin-1.0', 'rack-1.0' should_have_gems 'foo-1.0' - vendored_gems("bin/rackup").should_not exist + expect(vendored_gems("bin/rackup")).not_to exist end it "does not call clean automatically when using system gems" do @@ -294,8 +294,8 @@ describe "bundle clean" do bundle :install sys_exec "gem list" - out.should include("rack (1.0.0)") - out.should include("thin (1.0)") + expect(out).to include("rack (1.0.0)") + expect(out).to include("thin (1.0)") end it "--clean should override the bundle setting on install" do @@ -391,7 +391,7 @@ describe "bundle clean" do bundle :update sys_exec "gem list" - out.should include("foo (1.0.1, 1.0)") + expect(out).to include("foo (1.0.1, 1.0)") end it "cleans system gems when --force is used" do @@ -411,10 +411,10 @@ describe "bundle clean" do bundle :install bundle "clean --force" - out.should eq("Removing foo (1.0)") + expect(out).to eq("Removing foo (1.0)") sys_exec "gem list" - out.should_not include("foo (1.0)") - out.should include("rack (1.0.0)") + expect(out).not_to include("foo (1.0)") + expect(out).to include("rack (1.0.0)") end it "cleans git gems with a 7 length git revision" do @@ -442,9 +442,9 @@ describe "bundle clean" do bundle :clean - out.should_not include("Removing foo (1.0 #{revision[0..6]})") + expect(out).not_to include("Removing foo (1.0 #{revision[0..6]})") - vendored_gems("bundler/gems/foo-1.0-#{revision[0..6]}").should exist + expect(vendored_gems("bundler/gems/foo-1.0-#{revision[0..6]}")).to exist end it "when using --force on system gems, it doesn't remove binaries" do @@ -467,8 +467,8 @@ describe "bundle clean" do sys_status "foo" - exitstatus.should eq(0) - out.should eq("1.0") + expect(exitstatus).to eq(0) + expect(out).to eq("1.0") end it "doesn't blow up on path gems without a .gempsec" do @@ -489,6 +489,6 @@ describe "bundle clean" do bundle "install --path vendor/bundle" bundle :clean, :exitstatus => true - exitstatus.should eq(0) + expect(exitstatus).to eq(0) end end diff --git a/spec/other/config_spec.rb b/spec/other/config_spec.rb index e1b92bd49b..8a30c688ae 100644 --- a/spec/other/config_spec.rb +++ b/spec/other/config_spec.rb @@ -13,8 +13,8 @@ describe ".bundle/config" do ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s bundle "install --path vendor/bundle" - bundled_app('.bundle').should_not exist - tmp('foo/bar/config').should exist + expect(bundled_app('.bundle')).not_to exist + expect(tmp('foo/bar/config')).to exist should_be_installed "rack 1.0.0" end @@ -25,8 +25,8 @@ describe ".bundle/config" do ENV['BUNDLE_APP_CONFIG'] = "../foo" bundle "install --path vendor/bundle" - bundled_app(".bundle").should_not exist - bundled_app("../foo/config").should exist + expect(bundled_app(".bundle")).not_to exist + expect(bundled_app("../foo/config")).to exist should_be_installed "rack 1.0.0" end @@ -36,7 +36,7 @@ describe ".bundle/config" do bundle "install" FileUtils.touch tmp('foo/bar/environment.rb') should_be_installed "rack 1.0.0" - tmp('foo/bar/environment.rb').should_not exist + expect(tmp('foo/bar/environment.rb')).not_to exist end end @@ -46,23 +46,23 @@ describe ".bundle/config" do it "is the default" do bundle "config foo global" run "puts Bundler.settings[:foo]" - out.should == "global" + expect(out).to eq("global") end it "can also be set explicitly" do bundle "config --global foo global" run "puts Bundler.settings[:foo]" - out.should == "global" + expect(out).to eq("global") end it "has lower precedence than local" do bundle "config --local foo local" bundle "config --global foo global" - out.should =~ /Your application has set foo to "local"/ + expect(out).to match(/Your application has set foo to "local"/) run "puts Bundler.settings[:foo]" - out.should == "local" + expect(out).to eq("local") end it "has lower precedence than env" do @@ -70,10 +70,10 @@ describe ".bundle/config" do ENV["BUNDLE_FOO"] = "env" bundle "config --global foo global" - out.should =~ /You have a bundler environment variable for foo set to "env"/ + expect(out).to match(/You have a bundler environment variable for foo set to "env"/) run "puts Bundler.settings[:foo]" - out.should == "env" + expect(out).to eq("env") ensure ENV.delete("BUNDLE_FOO") end @@ -84,16 +84,16 @@ describe ".bundle/config" do bundle "config --delete foo" run "puts Bundler.settings[:foo] == nil" - out.should == "true" + expect(out).to eq("true") end it "warns when overriding" do bundle "config --global foo previous" bundle "config --global foo global" - out.should =~ /You are replacing the current global value of foo/ + expect(out).to match(/You are replacing the current global value of foo/) run "puts Bundler.settings[:foo]" - out.should == "global" + expect(out).to eq("global") end end @@ -103,7 +103,7 @@ describe ".bundle/config" do it "can also be set explicitly" do bundle "config --local foo local" run "puts Bundler.settings[:foo]" - out.should == "local" + expect(out).to eq("local") end it "has higher precedence than env" do @@ -112,7 +112,7 @@ describe ".bundle/config" do bundle "config --local foo local" run "puts Bundler.settings[:foo]" - out.should == "local" + expect(out).to eq("local") ensure ENV.delete("BUNDLE_FOO") end @@ -123,16 +123,16 @@ describe ".bundle/config" do bundle "config --delete foo" run "puts Bundler.settings[:foo] == nil" - out.should == "true" + expect(out).to eq("true") end it "warns when overriding" do bundle "config --local foo previous" bundle "config --local foo local" - out.should =~ /You are replacing the current local value of foo/ + expect(out).to match(/You are replacing the current local value of foo/) run "puts Bundler.settings[:foo]" - out.should == "local" + expect(out).to eq("local") end end -end
\ No newline at end of file +end diff --git a/spec/other/console_spec.rb b/spec/other/console_spec.rb index 254c059b7b..b72883a01c 100644 --- a/spec/other/console_spec.rb +++ b/spec/other/console_spec.rb @@ -15,7 +15,7 @@ describe "bundle console" do input.puts("puts RACK") input.puts("exit") end - out.should include("0.9.1") + expect(out).to include("0.9.1") end it "doesn't load any other groups" do @@ -23,7 +23,7 @@ describe "bundle console" do input.puts("puts ACTIVESUPPORT") input.puts("exit") end - out.should include("NameError") + expect(out).to include("NameError") end describe "when given a group" do @@ -32,7 +32,7 @@ describe "bundle console" do input.puts("puts ACTIVESUPPORT") input.puts("exit") end - out.should include("2.3.5") + expect(out).to include("2.3.5") end it "loads the default group" do @@ -40,7 +40,7 @@ describe "bundle console" do input.puts("puts RACK") input.puts("exit") end - out.should include("0.9.1") + expect(out).to include("0.9.1") end it "doesn't load other groups" do @@ -48,7 +48,7 @@ describe "bundle console" do input.puts("puts RACK_MIDDLEWARE") input.puts("exit") end - out.should include("NameError") + expect(out).to include("NameError") end end end diff --git a/spec/other/exec_spec.rb b/spec/other/exec_spec.rb index 30a96a8315..34f8478bfb 100644 --- a/spec/other/exec_spec.rb +++ b/spec/other/exec_spec.rb @@ -11,7 +11,7 @@ describe "bundle exec" do G bundle "exec rackup" - out.should == "0.9.1" + expect(out).to eq("0.9.1") end it "works when the bins are in ~/.bundle" do @@ -20,7 +20,7 @@ describe "bundle exec" do G bundle "exec rackup" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end it "works when running from a random directory" do @@ -30,13 +30,13 @@ describe "bundle exec" do bundle "exec 'cd #{tmp('gems')} && rackup'" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end it "works when exec'ing something else" do install_gemfile 'gem "rack"' bundle "exec echo exec" - out.should == "exec" + expect(out).to eq("exec") end it "handles different versions in different bundles" do @@ -60,11 +60,11 @@ describe "bundle exec" do bundle "exec rackup" - out.should eq("0.9.1") + expect(out).to eq("0.9.1") Dir.chdir bundled_app2 do bundle "exec rackup" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end end @@ -80,7 +80,7 @@ describe "bundle exec" do bundle "exec rackup" - out.should eq("0.9.1") + expect(out).to eq("0.9.1") should_not_be_installed "rack_middleware 1.0" end @@ -93,10 +93,10 @@ describe "bundle exec" do rubyopt = "-I#{bundler_path} -rbundler/setup #{rubyopt}" bundle "exec 'echo $RUBYOPT'" - out.should have_rubyopts(rubyopt) + expect(out).to have_rubyopts(rubyopt) bundle "exec 'echo $RUBYOPT'", :env => {"RUBYOPT" => rubyopt} - out.should have_rubyopts(rubyopt) + expect(out).to have_rubyopts(rubyopt) end it "errors nicely when the argument doesn't exist" do @@ -105,9 +105,9 @@ describe "bundle exec" do G bundle "exec foobarbaz", :exitstatus => true - exitstatus.should eq(127) - out.should include("bundler: command not found: foobarbaz") - out.should include("Install missing gem executables with `bundle install`") + expect(exitstatus).to eq(127) + expect(out).to include("bundler: command not found: foobarbaz") + expect(out).to include("Install missing gem executables with `bundle install`") end it "errors nicely when the argument is not executable" do @@ -117,8 +117,8 @@ describe "bundle exec" do bundle "exec touch foo" bundle "exec ./foo", :exitstatus => true - exitstatus.should eq(126) - out.should include("bundler: not executable: ./foo") + expect(exitstatus).to eq(126) + expect(out).to include("bundler: not executable: ./foo") end it "errors nicely when no arguments are passed" do @@ -128,7 +128,7 @@ describe "bundle exec" do bundle "exec", :exitstatus => true # exitstatus.should eq(128) - out.should include("bundler: exec needs a command to run") + expect(out).to include("bundler: exec needs a command to run") end describe "with gem executables" do @@ -141,14 +141,14 @@ describe "bundle exec" do it "works when unlocked" do bundle "exec 'cd #{tmp('gems')} && rackup'" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end it "works when locked" do bundle "lock" should_be_locked bundle "exec 'cd #{tmp('gems')} && rackup'" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end end @@ -165,7 +165,7 @@ describe "bundle exec" do it "works when unlocked" do bundle "exec fizz" - out.should == "1.0" + expect(out).to eq("1.0") end it "works when locked" do @@ -173,7 +173,7 @@ describe "bundle exec" do should_be_locked bundle "exec fizz" - out.should == "1.0" + expect(out).to eq("1.0") end end @@ -190,14 +190,14 @@ describe "bundle exec" do it "works when unlocked" do bundle "exec fizz_git" - out.should == "1.0" + expect(out).to eq("1.0") end it "works when locked" do bundle "lock" should_be_locked bundle "exec fizz_git" - out.should == "1.0" + expect(out).to eq("1.0") end end @@ -214,14 +214,14 @@ describe "bundle exec" do it "works when unlocked" do bundle "exec fizz_no_gemspec" - out.should == "1.0" + expect(out).to eq("1.0") end it "works when locked" do bundle "lock" should_be_locked bundle "exec fizz_no_gemspec" - out.should == "1.0" + expect(out).to eq("1.0") end end diff --git a/spec/other/ext_spec.rb b/spec/other/ext_spec.rb index ff6864ef48..1509bc5f52 100644 --- a/spec/other/ext_spec.rb +++ b/spec/other/ext_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe "Gem::Specification#match_platform" do it "does not match platforms other than the gem platform" do darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10" - darwin.match_platform(pl('java')).should be_false + expect(darwin.match_platform(pl('java'))).to be_false end end @@ -11,7 +11,7 @@ describe "Bundler::GemHelpers#generic" do include Bundler::GemHelpers it "converts non-windows platforms into ruby" do - generic(pl('x86-darwin-10')).should == pl('ruby') + expect(generic(pl('x86-darwin-10'))).to eq(pl('ruby')) end end @@ -34,4 +34,4 @@ describe "Gem::SourceIndex#refresh!" do run "Gem.source_index.refresh!" run "Gem::SourceIndex.from_gems_in([]).refresh!" end -end
\ No newline at end of file +end diff --git a/spec/other/help_spec.rb b/spec/other/help_spec.rb index 4896fd44bb..068aad2039 100644 --- a/spec/other/help_spec.rb +++ b/spec/other/help_spec.rb @@ -7,33 +7,33 @@ describe "bundle help" do system_gems "bundler-0.8.1" bundle "help", :expect_err => true - err.should include("Please remove Bundler 0.8 versions.") - err.should include("This can be done by running `gem cleanup bundler`.") + expect(err).to include("Please remove Bundler 0.8 versions.") + expect(err).to include("This can be done by running `gem cleanup bundler`.") end it "uses groff when available" do fake_groff! bundle "help gemfile" - out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/gemfile.5"]| + expect(out).to eq(%|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/gemfile.5"]|) end it "prefixes bundle commands with bundle- when finding the groff files" do fake_groff! bundle "help install" - out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/bundle-install"]| + expect(out).to eq(%|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/bundle-install"]|) end it "simply outputs the txt file when there is no groff on the path" do kill_path! bundle "help install", :expect_err => true - out.should =~ /BUNDLE-INSTALL/ + expect(out).to match(/BUNDLE-INSTALL/) end it "still outputs the old help for commands that do not have man pages yet" do bundle "help check" - out.should include("Check searches the local machine") + expect(out).to include("Check searches the local machine") end end diff --git a/spec/other/init_spec.rb b/spec/other/init_spec.rb index 0b9f447021..1c686461e6 100644 --- a/spec/other/init_spec.rb +++ b/spec/other/init_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" describe "bundle init" do it "generates a Gemfile" do bundle :init - bundled_app("Gemfile").should exist + expect(bundled_app("Gemfile")).to exist end it "does not change existing Gemfiles" do @@ -11,9 +11,9 @@ describe "bundle init" do gem "rails" G - lambda { + expect { bundle :init - }.should_not change { File.read(bundled_app("Gemfile")) } + }.not_to change { File.read(bundled_app("Gemfile")) } end it "should generate from an existing gemspec" do @@ -31,10 +31,10 @@ describe "bundle init" do bundle :init, :gemspec => spec_file gemfile = bundled_app("Gemfile").read - gemfile.should =~ /source :gemcutter/ - gemfile.scan(/gem "rack", "= 1.0.1"/).size.should eq(1) - gemfile.scan(/gem "rspec", "= 1.2"/).size.should eq(1) - gemfile.scan(/group :development/).size.should eq(1) + expect(gemfile).to match(/source :gemcutter/) + expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1) + expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1) + expect(gemfile.scan(/group :development/).size).to eq(1) end -end
\ No newline at end of file +end diff --git a/spec/other/newgem_spec.rb b/spec/other/newgem_spec.rb index e994c7279d..501f8cfa2a 100644 --- a/spec/other/newgem_spec.rb +++ b/spec/other/newgem_spec.rb @@ -19,30 +19,30 @@ describe "bundle gem" do let(:generated_gem) { Bundler::GemHelper.new(bundled_app("test-gem").to_s) } it "generates a gem skeleton" do - bundled_app("test-gem/test-gem.gemspec").should exist - bundled_app("test-gem/LICENSE.txt").should exist - bundled_app("test-gem/Gemfile").should exist - bundled_app("test-gem/Rakefile").should exist - bundled_app("test-gem/lib/test-gem.rb").should exist - bundled_app("test-gem/lib/test-gem/version.rb").should exist + expect(bundled_app("test-gem/test-gem.gemspec")).to exist + expect(bundled_app("test-gem/LICENSE.txt")).to exist + expect(bundled_app("test-gem/Gemfile")).to exist + expect(bundled_app("test-gem/Rakefile")).to exist + expect(bundled_app("test-gem/lib/test-gem.rb")).to exist + expect(bundled_app("test-gem/lib/test-gem/version.rb")).to exist end it "starts with version 0.0.1" do - bundled_app("test-gem/lib/test-gem/version.rb").read.should =~ /VERSION = "0.0.1"/ + expect(bundled_app("test-gem/lib/test-gem/version.rb").read).to match(/VERSION = "0.0.1"/) end it "nests constants so they work" do - bundled_app("test-gem/lib/test-gem/version.rb").read.should =~ /module Test\n module Gem/ - bundled_app("test-gem/lib/test-gem.rb").read.should =~ /module Test\n module Gem/ + expect(bundled_app("test-gem/lib/test-gem/version.rb").read).to match(/module Test\n module Gem/) + expect(bundled_app("test-gem/lib/test-gem.rb").read).to match(/module Test\n module Gem/) end context "git config user.{name,email} present" do it "sets gemspec author to git user.name if available" do - generated_gem.gemspec.authors.first.should == "Bundler User" + expect(generated_gem.gemspec.authors.first).to eq("Bundler User") end it "sets gemspec email to git user.email if available" do - generated_gem.gemspec.email.first.should == "user@example.com" + expect(generated_gem.gemspec.email.first).to eq("user@example.com") end end @@ -56,20 +56,20 @@ describe "bundle gem" do end it "sets gemspec author to default message if git user.name is not set or empty" do - generated_gem.gemspec.authors.first.should == "TODO: Write your name" + expect(generated_gem.gemspec.authors.first).to eq("TODO: Write your name") end it "sets gemspec email to default message if git user.email is not set or empty" do - generated_gem.gemspec.email.first.should == "TODO: Write your email address" + expect(generated_gem.gemspec.email.first).to eq("TODO: Write your email address") end end it "sets gemspec license to MIT by default" do - generated_gem.gemspec.license.should == "MIT" + expect(generated_gem.gemspec.license).to eq("MIT") end it "requires the version file" do - bundled_app("test-gem/lib/test-gem.rb").read.should =~ /require "test-gem\/version"/ + expect(bundled_app("test-gem/lib/test-gem.rb").read).to match(/require "test-gem\/version"/) end it "runs rake without problems" do @@ -86,7 +86,7 @@ RAKEFILE Dir.chdir(bundled_app("test-gem")) do sys_exec("rake") - out.should include("SUCCESS") + expect(out).to include("SUCCESS") end end end diff --git a/spec/other/open_spec.rb b/spec/other/open_spec.rb index cf58cc673d..6a601943ed 100644 --- a/spec/other/open_spec.rb +++ b/spec/other/open_spec.rb @@ -10,31 +10,31 @@ describe "bundle open" do it "opens the gem with BUNDLER_EDITOR as highest priority" do bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor"} - out.should == "bundler_editor #{default_bundle_path('gems', 'rails-2.3.2')}" + expect(out).to eq("bundler_editor #{default_bundle_path('gems', 'rails-2.3.2')}") end it "opens the gem with VISUAL as 2nd highest priority" do bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => ""} - out.should == "visual #{default_bundle_path('gems', 'rails-2.3.2')}" + expect(out).to eq("visual #{default_bundle_path('gems', 'rails-2.3.2')}") end it "opens the gem with EDITOR as 3rd highest priority" do bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""} - out.should == "editor #{default_bundle_path('gems', 'rails-2.3.2')}" + expect(out).to eq("editor #{default_bundle_path('gems', 'rails-2.3.2')}") end it "complains if no EDITOR is set" do bundle "open rails", :env => {"EDITOR" => "", "VISUAL" => "", "BUNDLER_EDITOR" => ""} - out.should == "To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR" + expect(out).to eq("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") end it "complains if gem not in bundle" do bundle "open missing", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""} - out.should match(/could not find gem 'missing'/i) + expect(out).to match(/could not find gem 'missing'/i) end it "suggests alternatives for similar-sounding gems" do bundle "open Rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""} - out.should match(/did you mean rails\?/i) + expect(out).to match(/did you mean rails\?/i) end end diff --git a/spec/other/outdated_spec.rb b/spec/other/outdated_spec.rb index af38f30e44..4eab6b61b8 100644 --- a/spec/other/outdated_spec.rb +++ b/spec/other/outdated_spec.rb @@ -22,8 +22,8 @@ describe "bundle outdated" do end bundle "outdated" - out.should include("activesupport (3.0 > 2.3.5)") - out.should include("foo (1.0") + expect(out).to include("activesupport (3.0 > 2.3.5)") + expect(out).to include("foo (1.0") end end @@ -32,7 +32,7 @@ describe "bundle outdated" do FileUtils.rm_rf(gem_repo2) bundle "outdated --local" - out.should_not match(/Fetching/) + expect(out).not_to match(/Fetching/) end end @@ -44,8 +44,8 @@ describe "bundle outdated" do end bundle "outdated foo" - out.should_not include("activesupport (3.0 > 2.3.5)") - out.should include("foo (1.0") + expect(out).not_to include("activesupport (3.0 > 2.3.5)") + expect(out).to include("foo (1.0") end end @@ -57,7 +57,7 @@ describe "bundle outdated" do end bundle "outdated" - out.should_not include("activesupport (3.0.0.beta > 2.3.5)") + expect(out).not_to include("activesupport (3.0.0.beta > 2.3.5)") end end @@ -68,7 +68,7 @@ describe "bundle outdated" do end bundle "outdated --pre" - out.should include("activesupport (3.0.0.beta > 2.3.5)") + expect(out).to include("activesupport (3.0.0.beta > 2.3.5)") end end @@ -85,7 +85,7 @@ describe "bundle outdated" do G bundle "outdated" - out.should include("activesupport (3.0.0.beta.2 > 3.0.0.beta.1)") + expect(out).to include("activesupport (3.0.0.beta.2 > 3.0.0.beta.1)") end end end diff --git a/spec/other/platform_spec.rb b/spec/other/platform_spec.rb index 9bc786f27b..625c961c1d 100644 --- a/spec/other/platform_spec.rb +++ b/spec/other/platform_spec.rb @@ -12,7 +12,7 @@ describe "bundle platform" do G bundle "platform" - out.should == <<-G.chomp + expect(out).to eq(<<-G.chomp) Your platform is: #{RUBY_PLATFORM} Your app has gems that work on these platforms: @@ -33,7 +33,7 @@ G G bundle "platform" - out.should == <<-G.chomp + expect(out).to eq(<<-G.chomp) Your platform is: #{RUBY_PLATFORM} Your app has gems that work on these platforms: @@ -53,7 +53,7 @@ G G bundle "platform" - out.should == <<-G.chomp + expect(out).to eq(<<-G.chomp) Your platform is: #{RUBY_PLATFORM} Your app has gems that work on these platforms: @@ -78,7 +78,7 @@ G bundle "platform --ruby" - out.should eq("ruby 1.9.3") + expect(out).to eq("ruby 1.9.3") end it "engine defaults to MRI" do @@ -91,7 +91,7 @@ G bundle "platform --ruby" - out.should eq("ruby 1.9.3") + expect(out).to eq("ruby 1.9.3") end it "handles jruby" do @@ -104,7 +104,7 @@ G bundle "platform --ruby" - out.should eq("ruby 1.8.7 (jruby 1.6.5)") + expect(out).to eq("ruby 1.8.7 (jruby 1.6.5)") end it "handles rbx" do @@ -117,7 +117,7 @@ G bundle "platform --ruby" - out.should eq("ruby 1.8.7 (rbx 1.2.4)") + expect(out).to eq("ruby 1.8.7 (rbx 1.2.4)") end it "raises an error if engine is used but engine version is not" do @@ -130,7 +130,7 @@ G bundle "platform", :exitstatus => true - exitstatus.should_not == 0 + expect(exitstatus).not_to eq(0) end it "raises an error if engine_version is used but engine is not" do @@ -143,7 +143,7 @@ G bundle "platform", :exitstatus => true - exitstatus.should_not == 0 + expect(exitstatus).not_to eq(0) end it "raises an error if engine version doesn't match ruby version for mri" do @@ -156,7 +156,7 @@ G bundle "platform", :exitstatus => true - exitstatus.should_not == 0 + expect(exitstatus).not_to eq(0) end end @@ -167,18 +167,18 @@ G let(:engine_version_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_engine_version}\"" } def should_be_ruby_version_incorrect(opts = {:exitstatus => true}) - exitstatus.should eq(18) if opts[:exitstatus] - out.should be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}") + expect(exitstatus).to eq(18) if opts[:exitstatus] + expect(out).to be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}") end def should_be_engine_incorrect(opts = {:exitstatus => true}) - exitstatus.should eq(18) if opts[:exitstatus] - out.should be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}") + expect(exitstatus).to eq(18) if opts[:exitstatus] + expect(out).to be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}") end def should_be_engine_version_incorrect(opts = {:exitstatus => true}) - exitstatus.should eq(18) if opts[:exitstatus] - out.should be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}") + expect(exitstatus).to eq(18) if opts[:exitstatus] + expect(out).to be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}") end context "bundle install" do @@ -190,7 +190,7 @@ G #{ruby_version_correct} G - bundled_app('Gemfile.lock').should exist + expect(bundled_app('Gemfile.lock')).to exist end it "installs fine with any engine" do @@ -202,7 +202,7 @@ G #{ruby_version_correct_engineless} G - bundled_app('Gemfile.lock').should exist + expect(bundled_app('Gemfile.lock')).to exist end end @@ -214,7 +214,7 @@ G #{ruby_version_incorrect} G - bundled_app('Gemfile.lock').should_not exist + expect(bundled_app('Gemfile.lock')).not_to exist should_be_ruby_version_incorrect end @@ -226,7 +226,7 @@ G #{engine_incorrect} G - bundled_app('Gemfile.lock').should_not exist + expect(bundled_app('Gemfile.lock')).not_to exist should_be_engine_incorrect end @@ -239,7 +239,7 @@ G #{engine_version_incorrect} G - bundled_app('Gemfile.lock').should_not exist + expect(bundled_app('Gemfile.lock')).not_to exist should_be_engine_version_incorrect end end @@ -260,8 +260,8 @@ G G bundle :check, :exitstatus => true - exitstatus.should eq(0) - out.should == "The Gemfile's dependencies are satisfied" + expect(exitstatus).to eq(0) + expect(out).to eq("The Gemfile's dependencies are satisfied") end it "checks fine with any engine" do @@ -279,8 +279,8 @@ G G bundle :check, :exitstatus => true - exitstatus.should eq(0) - out.should == "The Gemfile's dependencies are satisfied" + expect(exitstatus).to eq(0) + expect(out).to eq("The Gemfile's dependencies are satisfied") end end @@ -451,7 +451,7 @@ G G bundle "show rails" - out.should == default_bundle_path('gems', 'rails-2.3.2').to_s + expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s) end it "prints path if ruby version is correct for any engine" do @@ -464,7 +464,7 @@ G G bundle "show rails" - out.should == default_bundle_path('gems', 'rails-2.3.2').to_s + expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s) end end @@ -524,7 +524,7 @@ G G bundle :cache - bundled_app("vendor/cache/rack-1.0.0.gem").should exist + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end it "copies the .gem file to vendor/cache when ruby version matches for any engine" do @@ -536,7 +536,7 @@ G G bundle :cache - bundled_app("vendor/cache/rack-1.0.0.gem").should exist + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end end @@ -593,7 +593,7 @@ G G bundle :pack - bundled_app("vendor/cache/rack-1.0.0.gem").should exist + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end it "copies the .gem file to vendor/cache when ruby version matches any engine" do @@ -605,7 +605,7 @@ G G bundle :pack - bundled_app("vendor/cache/rack-1.0.0.gem").should exist + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end end @@ -658,7 +658,7 @@ G G bundle "exec rackup" - out.should == "0.9.1" + expect(out).to eq("0.9.1") end it "activates the correct gem when ruby version matches any engine" do @@ -670,7 +670,7 @@ G G bundle "exec rackup" - out.should == "0.9.1" + expect(out).to eq("0.9.1") end end @@ -734,7 +734,7 @@ G input.puts("puts RACK") input.puts("exit") end - out.should include("0.9.1") + expect(out).to include("0.9.1") end it "starts IRB with the default group loaded when ruby version matches any engine" do @@ -752,7 +752,7 @@ G input.puts("puts RACK") input.puts("exit") end - out.should include("0.9.1") + expect(out).to include("0.9.1") end end @@ -824,7 +824,7 @@ G FileUtils.rm(bundled_app("Gemfile.lock")) run "1" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end it "makes a Gemfile.lock if setup succeeds for any engine" do @@ -842,7 +842,7 @@ G FileUtils.rm(bundled_app("Gemfile.lock")) run "1" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end end @@ -870,7 +870,7 @@ G end R - bundled_app("Gemfile.lock").should_not exist + expect(bundled_app("Gemfile.lock")).not_to exist should_be_ruby_version_incorrect(:exitstatus => false) end @@ -898,7 +898,7 @@ G end R - bundled_app("Gemfile.lock").should_not exist + expect(bundled_app("Gemfile.lock")).not_to exist should_be_engine_incorrect(:exitstatus => false) end @@ -927,7 +927,7 @@ G end R - bundled_app("Gemfile.lock").should_not exist + expect(bundled_app("Gemfile.lock")).not_to exist should_be_engine_version_incorrect(:exitstatus => false) end end @@ -961,8 +961,8 @@ G G bundle "outdated" - out.should include("activesupport (3.0 > 2.3.5)") - out.should include("foo (1.0") + expect(out).to include("activesupport (3.0 > 2.3.5)") + expect(out).to include("foo (1.0") end it "returns list of outdated gems when the ruby version matches for any engine" do @@ -981,8 +981,8 @@ G G bundle "outdated" - out.should include("activesupport (3.0 > 2.3.5)") - out.should include("foo (1.0") + expect(out).to include("activesupport (3.0 > 2.3.5)") + expect(out).to include("foo (1.0") end end diff --git a/spec/other/show_spec.rb b/spec/other/show_spec.rb index d14114e801..a44b330cd0 100644 --- a/spec/other/show_spec.rb +++ b/spec/other/show_spec.rb @@ -13,7 +13,7 @@ describe "bundle show" do bundle "show" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end it "creates a Gemfile.lock when invoked with a gem name" do @@ -21,28 +21,28 @@ describe "bundle show" do bundle "show rails" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end it "prints path if gem exists in bundle" do bundle "show rails" - out.should == default_bundle_path('gems', 'rails-2.3.2').to_s + expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s) end it "prints the path to the running bundler" do bundle "show bundler" - out.should == File.expand_path('../../../', __FILE__) + expect(out).to eq(File.expand_path('../../../', __FILE__)) end it "complains if gem not in bundle" do bundle "show missing" - out.should =~ /could not find gem 'missing'/i + expect(out).to match(/could not find gem 'missing'/i) end it "prints path of all gems in bundle" do bundle "show --paths" - out.should include(default_bundle_path('gems', 'rake-0.8.7').to_s) - out.should include(default_bundle_path('gems', 'rails-2.3.2').to_s) + expect(out).to include(default_bundle_path('gems', 'rake-0.8.7').to_s) + expect(out).to include(default_bundle_path('gems', 'rails-2.3.2').to_s) end end @@ -58,7 +58,7 @@ describe "bundle show with a git repo" do should_be_installed "foo 1.0" bundle :show - out.should include("foo (1.0 #{@git.ref_for('master', 6)}") + expect(out).to include("foo (1.0 #{@git.ref_for('master', 6)}") end it "prints out branch names other than master" do @@ -73,7 +73,7 @@ describe "bundle show with a git repo" do should_be_installed "foo 1.0.omg" bundle :show - out.should include("foo (1.0 #{@git.ref_for('omg', 6)}") + expect(out).to include("foo (1.0 #{@git.ref_for('omg', 6)}") end it "doesn't print the branch when tied to a ref" do @@ -83,6 +83,6 @@ describe "bundle show with a git repo" do G bundle :show - out.should include("foo (1.0 #{sha[0..6]})") + expect(out).to include("foo (1.0 #{sha[0..6]})") end end diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index f7b5984233..32ce2d99a5 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -47,13 +47,13 @@ describe "The library itself" do error_messages << check_for_extra_spaces(filename) end end - error_messages.compact.should be_well_formed + expect(error_messages.compact).to be_well_formed end it "can still be built" do Dir.chdir(root) do `gem build bundler.gemspec` - $?.should eq(0) + expect($?).to eq(0) # clean up the .gem generated system("rm bundler-#{Bundler::VERSION}.gem") diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb index 7ae37f570e..e444e3b948 100644 --- a/spec/realworld/edgecases_spec.rb +++ b/spec/realworld/edgecases_spec.rb @@ -7,7 +7,7 @@ describe "real world edgecases", :realworld => true do source :rubygems gem "linecache", "0.46" G - err.should eq("") + expect(err).to eq("") end # https://github.com/carlhuda/bundler/issues/1202 @@ -18,7 +18,7 @@ describe "real world edgecases", :realworld => true do gem "will_paginate", "3.0.pre2" G bundle :cache - out.should_not include("Removing outdated .gem files from vendor/cache") + expect(out).not_to include("Removing outdated .gem files from vendor/cache") end # https://github.com/carlhuda/bundler/issues/1486 @@ -32,7 +32,7 @@ describe "real world edgecases", :realworld => true do gem 'activerecord', '~> 3.0' gem 'builder', '~> 2.1.2' G - out.should include("activemodel (3.0.5)") + expect(out).to include("activemodel (3.0.5)") end # https://github.com/carlhuda/bundler/issues/1500 @@ -45,8 +45,8 @@ describe "real world edgecases", :realworld => true do G bundle "install --path vendor/bundle", :expect_err => true - err.should_not include("Could not find rake") - err.should be_empty + expect(err).not_to include("Could not find rake") + expect(err).to be_empty end it "checks out git repos when the lockfile is corrupted" do @@ -172,6 +172,6 @@ describe "real world edgecases", :realworld => true do L bundle :install, :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end end diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb index 4c71d39d6f..bafa6310c7 100644 --- a/spec/runtime/executable_spec.rb +++ b/spec/runtime/executable_spec.rb @@ -16,34 +16,34 @@ describe "Running bin/* commands" do end gembin "rackup" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end it "allows the location of the gem stubs to be specified" do bundle "install --binstubs gbin" - bundled_app("bin").should_not exist - bundled_app("gbin/rackup").should exist + expect(bundled_app("bin")).not_to exist + expect(bundled_app("gbin/rackup")).to exist gembin bundled_app("gbin/rackup") - out.should == "1.0.0" + expect(out).to eq("1.0.0") end it "allows absolute paths as a specification of where to install bin stubs" do bundle "install --binstubs #{tmp}/bin" gembin tmp("bin/rackup") - out.should == "1.0.0" + expect(out).to eq("1.0.0") end it "uses the default ruby install name when shebang is not specified" do bundle "install --binstubs" - File.open("bin/rackup").gets.should == "#!/usr/bin/env #{RbConfig::CONFIG['ruby_install_name']}\n" + expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env #{RbConfig::CONFIG['ruby_install_name']}\n") end it "allows the name of the shebang executable to be specified" do bundle "install --binstubs --shebang ruby-foo" - File.open("bin/rackup").gets.should == "#!/usr/bin/env ruby-foo\n" + expect(File.open("bin/rackup").gets).to eq("#!/usr/bin/env ruby-foo\n") end it "runs the bundled command when out of the bundle" do @@ -55,7 +55,7 @@ describe "Running bin/* commands" do Dir.chdir(tmp) do gembin "rackup" - out.should == "1.0.0" + expect(out).to eq("1.0.0") end end @@ -75,7 +75,7 @@ describe "Running bin/* commands" do end gembin "rackup" - out.should == '1.0' + expect(out).to eq('1.0') end it "don't bundle da bundla" do @@ -90,13 +90,13 @@ describe "Running bin/* commands" do bundle "install --binstubs" - bundled_app("bin/bundle").should_not exist + expect(bundled_app("bin/bundle")).not_to exist end it "does not generate bin stubs if the option was not specified" do bundle "install" - bundled_app("bin/rackup").should_not exist + expect(bundled_app("bin/rackup")).not_to exist end it "remembers that the option was specified" do @@ -115,6 +115,6 @@ describe "Running bin/* commands" do bundle "install" - bundled_app("bin/rackup").should exist + expect(bundled_app("bin/rackup")).to exist end -end
\ No newline at end of file +end diff --git a/spec/runtime/load_spec.rb b/spec/runtime/load_spec.rb index 45e1f6702a..086145d46d 100644 --- a/spec/runtime/load_spec.rb +++ b/spec/runtime/load_spec.rb @@ -21,34 +21,34 @@ describe "Bundler.load" do end it "provides a list of the env dependencies" do - Bundler.load.dependencies.should have_dep("rack", ">= 0") + expect(Bundler.load.dependencies).to have_dep("rack", ">= 0") end it "provides a list of the resolved gems" do - Bundler.load.gems.should have_gem("rack-1.0.0", "bundler-#{Bundler::VERSION}") + expect(Bundler.load.gems).to have_gem("rack-1.0.0", "bundler-#{Bundler::VERSION}") end it "ignores blank BUNDLE_GEMFILEs" do - lambda { + expect { ENV['BUNDLE_GEMFILE'] = "" Bundler.load - }.should_not raise_error(Bundler::GemfileNotFound) + }.not_to raise_error(Bundler::GemfileNotFound) end end describe "without a gemfile" do it "raises an exception if the default gemfile is not found" do - lambda { + expect { Bundler.load - }.should raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i) + }.to raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i) end it "raises an exception if a specified gemfile is not found" do - lambda { + expect { ENV['BUNDLE_GEMFILE'] = "omg.rb" Bundler.load - }.should raise_error(Bundler::GemfileNotFound, /omg\.rb/) + }.to raise_error(Bundler::GemfileNotFound, /omg\.rb/) end it "does not find a Gemfile above the testing directory" do @@ -58,7 +58,7 @@ describe "Bundler.load" do @remove_bundler_gemfile = true end begin - lambda { Bundler.load }.should raise_error(Bundler::GemfileNotFound) + expect { Bundler.load }.to raise_error(Bundler::GemfileNotFound) ensure bundler_gemfile.rmtree if @remove_bundler_gemfile end @@ -86,7 +86,7 @@ describe "Bundler.load" do end RUBY - out.split("\n").should == ["1.0.0", "no activesupport"] + expect(out.split("\n")).to eq(["1.0.0", "no activesupport"]) end end @@ -98,8 +98,8 @@ describe "Bundler.load" do G Bundler.load.specs.each do |spec| - spec.to_yaml.should_not =~ /^\s+source:/ - spec.to_yaml.should_not =~ /^\s+groups:/ + expect(spec.to_yaml).not_to match(/^\s+source:/) + expect(spec.to_yaml).not_to match(/^\s+groups:/) end end end diff --git a/spec/runtime/platform_spec.rb b/spec/runtime/platform_spec.rb index dc6c796517..1f9e2ec7c6 100644 --- a/spec/runtime/platform_spec.rb +++ b/spec/runtime/platform_spec.rb @@ -29,7 +29,7 @@ describe "Bundler.setup with multi platform stuff" do end R - out.should == "WIN" + expect(out).to eq("WIN") end it "will resolve correctly on the current platform when the lockfile was targetted for a different one" do diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb index 342deb8c73..349696606b 100644 --- a/spec/runtime/require_spec.rb +++ b/spec/runtime/require_spec.rb @@ -48,32 +48,32 @@ describe "Bundler.require" do it "requires the gems" do # default group run "Bundler.require" - out.should eq("two") + expect(out).to eq("two") # specific group run "Bundler.require(:bar)" - out.should eq("baz\nqux") + expect(out).to eq("baz\nqux") # default and specific group run "Bundler.require(:default, :bar)" - out.should eq("baz\nqux\ntwo") + expect(out).to eq("baz\nqux\ntwo") # specific group given as a string run "Bundler.require('bar')" - out.should eq("baz\nqux") + expect(out).to eq("baz\nqux") # specific group declared as a string run "Bundler.require(:string)" - out.should eq("six") + expect(out).to eq("six") # required in resolver order instead of gemfile order run("Bundler.require(:not)") - out.split("\n").sort.should == ['seven', 'three'] + expect(out.split("\n").sort).to eq(['seven', 'three']) end it "allows requiring gems with non standard names explicitly" do run "Bundler.require ; require 'mofive'" - out.should == "two\nfive" + expect(out).to eq("two\nfive") end it "raises an exception if a require is specified but the file does not exist" do @@ -86,7 +86,7 @@ describe "Bundler.require" do Bundler.require R - err.should == "ZOMG LOAD ERROR" + expect(err).to eq("ZOMG LOAD ERROR") end describe "with namespaced gems" do @@ -104,7 +104,7 @@ describe "Bundler.require" do G run "Bundler.require" - out.should eq("jquery/rails") + expect(out).to eq("jquery/rails") end it "silently passes if the require fails" do @@ -122,7 +122,7 @@ describe "Bundler.require" do RUBY ruby(cmd, :expect_err => true) - err.should be_empty + expect(err).to be_empty end it "does not mangle explictly given requires" do @@ -134,7 +134,7 @@ describe "Bundler.require" do load_error_run <<-R, 'jquery-rails' Bundler.require R - err.should == "ZOMG LOAD ERROR" + expect(err).to eq("ZOMG LOAD ERROR") end it "handles the case where regex fails" do @@ -156,20 +156,20 @@ describe "Bundler.require" do RUBY run(cmd, :expect_err => true) - err.should == "ZOMG LOAD ERROR" + expect(err).to eq("ZOMG LOAD ERROR") end end describe "using bundle exec" do it "requires the locked gems" do bundle "exec ruby -e 'Bundler.require'" - out.should eq("two") + expect(out).to eq("two") bundle "exec ruby -e 'Bundler.require(:bar)'" - out.should eq("baz\nqux") + expect(out).to eq("baz\nqux") bundle "exec ruby -e 'Bundler.require(:default, :bar)'" - out.should == "baz\nqux\ntwo" + expect(out).to eq("baz\nqux\ntwo") end end @@ -206,7 +206,7 @@ describe "Bundler.require" do G run "Bundler.require" - out.should eq("two\nmodule_two\none") + expect(out).to eq("two\nmodule_two\none") end describe "a gem with different requires for different envs" do @@ -224,17 +224,17 @@ describe "Bundler.require" do it "requires both with Bundler.require(both)" do run "Bundler.require(:one, :two)" - out.should == "ONE\nTWO" + expect(out).to eq("ONE\nTWO") end it "requires one with Bundler.require(:one)" do run "Bundler.require(:one)" - out.should == "ONE" + expect(out).to eq("ONE") end it "requires :two with Bundler.require(:two)" do run "Bundler.require(:two)" - out.should == "TWO" + expect(out).to eq("TWO") end end @@ -246,7 +246,7 @@ describe "Bundler.require" do G run "Bundler.require" - out.should eq("two_not_loaded\none\ntwo") + expect(out).to eq("two_not_loaded\none\ntwo") end describe "with busted gems" do @@ -262,7 +262,7 @@ describe "Bundler.require" do load_error_run <<-R, 'no_such_file_omg' Bundler.require R - err.should == 'ZOMG LOAD ERROR' + expect(err).to eq('ZOMG LOAD ERROR') end end end @@ -281,7 +281,7 @@ describe "Bundler.require with platform specific dependencies" do G run "Bundler.require", :expect_err => true - err.should be_empty + expect(err).to be_empty end it "requires gems pinned to multiple platforms, including the current one" do @@ -295,7 +295,7 @@ describe "Bundler.require with platform specific dependencies" do run "Bundler.require; puts RACK", :expect_err => true - out.should eq("1.0.0") - err.should be_empty + expect(out).to eq("1.0.0") + expect(err).to be_empty end end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index fc935a8b13..e1a85f72bc 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -16,8 +16,8 @@ describe "Bundler.setup" do require 'rack' puts RACK RUBY - err.should eq("") - out.should eq("1.0.0") + expect(err).to eq("") + expect(out).to eq("1.0.0") end end @@ -42,8 +42,8 @@ describe "Bundler.setup" do puts "WIN" end RUBY - err.should eq("") - out.should eq("WIN") + expect(err).to eq("") + expect(out).to eq("WIN") end it "leaves all groups available if they were already" do @@ -56,8 +56,8 @@ describe "Bundler.setup" do require 'rack' puts RACK RUBY - err.should eq("") - out.should eq("1.0.0") + expect(err).to eq("") + expect(out).to eq("1.0.0") end it "leaves :default available if setup is called twice" do @@ -74,8 +74,8 @@ describe "Bundler.setup" do puts "FAIL" end RUBY - err.should eq("") - out.should match("WIN") + expect(err).to eq("") + expect(out).to match("WIN") end end @@ -97,7 +97,7 @@ describe "Bundler.setup" do end R - out.should == "WIN" + expect(out).to eq("WIN") end it "doesn't create a Gemfile.lock if the setup fails" do @@ -113,7 +113,7 @@ describe "Bundler.setup" do Bundler.setup R - bundled_app("Gemfile.lock").should_not exist + expect(bundled_app("Gemfile.lock")).not_to exist end it "doesn't change the Gemfile.lock if the setup fails" do @@ -137,7 +137,7 @@ describe "Bundler.setup" do Bundler.setup R - File.read(bundled_app("Gemfile.lock")).should == lockfile + expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile) end it "makes a Gemfile.lock if setup succeeds" do @@ -151,7 +151,7 @@ describe "Bundler.setup" do FileUtils.rm(bundled_app("Gemfile.lock")) run "1" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end it "uses BUNDLE_GEMFILE to locate the gemfile if present" do @@ -204,7 +204,7 @@ describe "Bundler.setup" do end R - out.should == "WIN" + expect(out).to eq("WIN") end it "version_requirement is now deprecated in rubygems 1.4.0+ when gem is missing" do @@ -217,7 +217,7 @@ describe "Bundler.setup" do end R - err.should be_empty + expect(err).to be_empty end it "replaces #gem but raises when the version is wrong" do @@ -230,7 +230,7 @@ describe "Bundler.setup" do end R - out.should == "WIN" + expect(out).to eq("WIN") end it "version_requirement is now deprecated in rubygems 1.4.0+ when the version is wrong" do @@ -243,7 +243,7 @@ describe "Bundler.setup" do end R - err.should be_empty + expect(err).to be_empty end end @@ -258,14 +258,14 @@ describe "Bundler.setup" do it "removes system gems from Gem.source_index" do run "require 'yard'" - out.should == "bundler-#{Bundler::VERSION}\nyard-1.0" + expect(out).to eq("bundler-#{Bundler::VERSION}\nyard-1.0") end context "when the ruby stdlib is a substring of Gem.path" do it "does not reject the stdlib from $LOAD_PATH" do substring = "/" + $LOAD_PATH.find{|p| p =~ /vendor_ruby/ }.split("/")[2] run "puts 'worked!'", :env => {"GEM_PATH" => substring} - out.should == "worked!" + expect(out).to eq("worked!") end end end @@ -286,7 +286,7 @@ describe "Bundler.setup" do G run "require 'rack'" - out.should == "WIN" + expect(out).to eq("WIN") end end @@ -301,7 +301,7 @@ describe "Bundler.setup" do it "provides a useful exception when the git repo is not checked out yet" do run "1", :expect_err => true - err.should include("#{lib_path('rack-1.0.0')} (at master) is not checked out. Please run `bundle install`") + expect(err).to include("#{lib_path('rack-1.0.0')} (at master) is not checked out. Please run `bundle install`") end it "does not hit the git binary if the lockfile is available and up to date" do @@ -321,7 +321,7 @@ describe "Bundler.setup" do end R - out.should == "WIN" + expect(out).to eq("WIN") end it "provides a good exception if the lockfile is unavailable" do @@ -345,7 +345,7 @@ describe "Bundler.setup" do run "puts 'FAIL'", :expect_err => true - err.should_not include "This is not the git you are looking for" + expect(err).not_to include "This is not the git you are looking for" end it "works even when the cache directory has been deleted" do @@ -387,11 +387,11 @@ describe "Bundler.setup" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /at #{lib_path('local-rack')}/ + expect(out).to match(/at #{lib_path('local-rack')}/) FileUtils.rm_rf(lib_path('local-rack')) run "require 'rack'" - err.should =~ /Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/ + expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/) end it "explodes if branch is not given on runtime" do @@ -406,7 +406,7 @@ describe "Bundler.setup" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /at #{lib_path('local-rack')}/ + expect(out).to match(/at #{lib_path('local-rack')}/) gemfile <<-G source "file://#{gem_repo1}" @@ -414,7 +414,7 @@ describe "Bundler.setup" do G run "require 'rack'" - err.should =~ /because :branch is not specified in Gemfile/ + expect(err).to match(/because :branch is not specified in Gemfile/) end it "explodes on different branches on runtime" do @@ -429,7 +429,7 @@ describe "Bundler.setup" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /at #{lib_path('local-rack')}/ + expect(out).to match(/at #{lib_path('local-rack')}/) gemfile <<-G source "file://#{gem_repo1}" @@ -437,7 +437,7 @@ describe "Bundler.setup" do G run "require 'rack'" - err.should =~ /is using branch master but Gemfile specifies changed/ + expect(err).to match(/is using branch master but Gemfile specifies changed/) end it "explodes on refs with different branches on runtime" do @@ -457,7 +457,7 @@ describe "Bundler.setup" do bundle %|config local.rack #{lib_path('local-rack')}| run "require 'rack'" - err.should =~ /is using branch master but Gemfile specifies nonexistant/ + expect(err).to match(/is using branch master but Gemfile specifies nonexistant/) end end @@ -537,7 +537,7 @@ describe "Bundler.setup" do end R - out.should == "You have already activated thin 1.1, but your Gemfile requires thin 1.0. Using bundle exec may solve this." + expect(out).to == "You have already activated thin 1.1, but your Gemfile requires thin 1.0. Using bundle exec may solve this." end it "version_requirement is now deprecated in rubygems 1.4.0+" do @@ -562,7 +562,7 @@ describe "Bundler.setup" do end R - err.should be_empty + expect(err).to be_empty end end end @@ -585,7 +585,7 @@ describe "Bundler.setup" do end R - out.should be_empty + expect(out).to be_empty end it "ignores empty gem paths" do @@ -597,7 +597,7 @@ describe "Bundler.setup" do ENV["GEM_HOME"] = "" bundle %{exec ruby -e "require 'set'"} - err.should be_empty + expect(err).to be_empty end it "should prepend gemspec require paths to $LOAD_PATH in order" do @@ -615,7 +615,7 @@ describe "Bundler.setup" do G run "require 'rq'" - out.should == "yay" + expect(out).to eq("yay") end it "ignores Gem.refresh" do @@ -631,7 +631,7 @@ describe "Bundler.setup" do puts Bundler.rubygems.find_name("rack").inspect R - out.should == "[]" + expect(out).to eq("[]") end describe "when a vendored gem specification uses the :path option" do @@ -652,7 +652,7 @@ describe "Bundler.setup" do require 'foo' R end - err.should == "" + expect(err).to eq("") end it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do @@ -677,7 +677,7 @@ describe "Bundler.setup" do R end - err.should == "" + expect(err).to eq("") end end @@ -696,7 +696,7 @@ describe "Bundler.setup" do puts NOGEMSPEC R - out.should == "1.0" + expect(out).to eq("1.0") end end @@ -722,7 +722,7 @@ describe "Bundler.setup" do end R - out.should == "WIN" + expect(out).to eq("WIN") end it "provides a gem method" do @@ -732,7 +732,7 @@ describe "Bundler.setup" do puts ACTIVESUPPORT R - out.should == "2.3.5" + expect(out).to eq("2.3.5") end it "raises an exception if gem is used to invoke a system gem not in the bundle" do @@ -744,12 +744,12 @@ describe "Bundler.setup" do end R - out.should == "rack is not part of the bundle. Add it to Gemfile." + expect(out).to eq("rack is not part of the bundle. Add it to Gemfile.") end it "sets GEM_HOME appropriately" do run "puts ENV['GEM_HOME']" - out.should == default_bundle_path.to_s + expect(out).to eq(default_bundle_path.to_s) end end @@ -767,8 +767,8 @@ describe "Bundler.setup" do it "sets GEM_PATH appropriately" do run "puts Gem.path" paths = out.split("\n") - paths.should include(system_gem_path.to_s) - paths.should include(default_bundle_path.to_s) + expect(paths).to include(system_gem_path.to_s) + expect(paths).to include(default_bundle_path.to_s) end end @@ -798,7 +798,7 @@ describe "Bundler.setup" do it "evals each gemspec in the context of its parent directory" do bundle :install run "require 'bar'; puts BAR" - out.should == "1.0" + expect(out).to eq("1.0") end it "error intelligently if the gemspec has a LoadError" do @@ -806,10 +806,10 @@ describe "Bundler.setup" do s.write "bar.gemspec", "require 'foobarbaz'" end bundle :install - out.should include("was a LoadError while evaluating bar.gemspec") - out.should include("foobarbaz") - out.should include("bar.gemspec:1") - out.should include("try to require a relative path") if RUBY_VERSION >= "1.9" + expect(out).to include("was a LoadError while evaluating bar.gemspec") + expect(out).to include("foobarbaz") + expect(out).to include("bar.gemspec:1") + expect(out).to include("try to require a relative path") if RUBY_VERSION >= "1.9" end it "evals each gemspec with a binding from the top level" do @@ -823,8 +823,8 @@ describe "Bundler.setup" do Bundler.load RUBY - err.should eq("") - out.should eq("") + expect(err).to eq("") + expect(out).to eq("") end end @@ -835,7 +835,7 @@ describe "Bundler.setup" do G bundle %|exec ruby -e "require 'bundler'; Bundler.setup"| - err.should be_empty + expect(err).to be_empty end end diff --git a/spec/runtime/with_clean_env_spec.rb b/spec/runtime/with_clean_env_spec.rb index 0b5cc76616..7a77db0b4d 100644 --- a/spec/runtime/with_clean_env_spec.rb +++ b/spec/runtime/with_clean_env_spec.rb @@ -7,10 +7,10 @@ describe "Bundler.with_env helpers" do gem_path = ENV['GEM_PATH'] Bundler.with_clean_env do - `echo $GEM_PATH`.strip.should_not == gem_path + expect(`echo $GEM_PATH`.strip).not_to eq(gem_path) end - ENV['GEM_PATH'].should == gem_path + expect(ENV['GEM_PATH']).to eq(gem_path) end end @@ -34,12 +34,12 @@ describe "Bundler.with_env helpers" do "end" result = bundle "exec ruby -e #{code.inspect}" - result.should == "true" + expect(result).to eq("true") end it "should not pass any bundler environment variables" do Bundler.with_clean_env do - `echo $BUNDLE_PATH`.strip.should_not == './Gemfile' + expect(`echo $BUNDLE_PATH`.strip).not_to eq('./Gemfile') end end @@ -48,15 +48,15 @@ describe "Bundler.with_env helpers" do Bundler::ORIGINAL_ENV['RUBYOPT'] = " -I#{lib_path} -rbundler/setup" Bundler.with_clean_env do - `echo $RUBYOPT`.strip.should_not include '-rbundler/setup' - `echo $RUBYOPT`.strip.should_not include "-I#{lib_path}" + expect(`echo $RUBYOPT`.strip).not_to include '-rbundler/setup' + expect(`echo $RUBYOPT`.strip).not_to include "-I#{lib_path}" end - Bundler::ORIGINAL_ENV['RUBYOPT'].should == " -I#{lib_path} -rbundler/setup" + expect(Bundler::ORIGINAL_ENV['RUBYOPT']).to eq(" -I#{lib_path} -rbundler/setup") end it "should not change ORIGINAL_ENV" do - Bundler::ORIGINAL_ENV['BUNDLE_PATH'].should == './Gemfile' + expect(Bundler::ORIGINAL_ENV['BUNDLE_PATH']).to eq('./Gemfile') end end @@ -67,7 +67,7 @@ describe "Bundler.with_env helpers" do it "should pass bundler environment variables set before Bundler was run" do Bundler.with_original_env do - `echo $BUNDLE_PATH`.strip.should == './Gemfile' + expect(`echo $BUNDLE_PATH`.strip).to eq('./Gemfile') end end end @@ -75,7 +75,7 @@ describe "Bundler.with_env helpers" do describe "Bundler.clean_system" do it "runs system inside with_clean_env" do Bundler.clean_system(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh}) - $?.exitstatus.should == 42 + expect($?.exitstatus).to eq(42) end end @@ -85,7 +85,7 @@ describe "Bundler.with_env helpers" do Bundler.clean_exec(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh}) end Process.wait(pid) - $?.exitstatus.should == 42 + expect($?.exitstatus).to eq(42) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8528b20e01..ac27547704 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -71,6 +71,10 @@ RSpec.configure do |config| pending "JRuby executables do not have a proper shebang" if RUBY_PLATFORM == "java" end + config.expect_with :rspec do |c| + c.syntax = :expect + end + config.before :all do build_repo1 end diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb index f33501c8b2..ece7fd0479 100644 --- a/spec/support/indexes.rb +++ b/spec/support/indexes.rb @@ -26,7 +26,7 @@ module Spec def should_resolve_as(specs) got = resolve got = got.map { |s| s.full_name }.sort - got.should == specs.sort + expect(got).to eq(specs.sort) end def should_conflict_on(names) @@ -34,7 +34,7 @@ module Spec got = resolve flunk "The resolve succeeded with: #{got.map { |s| s.full_name }.sort.inspect}" rescue Bundler::VersionConflict => e - Array(names).sort.should == e.conflicts.sort + expect(Array(names).sort).to eq(e.conflicts.sort) end end @@ -109,4 +109,4 @@ module Spec end end end -end
\ No newline at end of file +end diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 361a03304e..e42c67be57 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -35,8 +35,8 @@ module Spec version_const = name == 'bundler' ? 'Bundler::VERSION' : Spec::Builders.constantize(name) run "require '#{name}.rb'; puts #{version_const}", *groups actual_version, actual_platform = out.split(/\s+/) - Gem::Version.new(actual_version).should eq(Gem::Version.new(version)) - actual_platform.should == platform + expect(Gem::Version.new(actual_version)).to eq(Gem::Version.new(version)) + expect(actual_platform).to eq(platform) end end @@ -56,22 +56,22 @@ module Spec end R if version.nil? || out == "WIN" - out.should == "WIN" + expect(out).to eq("WIN") else - Gem::Version.new(out).should_not == Gem::Version.new(version) + expect(Gem::Version.new(out)).not_to eq(Gem::Version.new(version)) end end end def should_be_locked - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end def lockfile_should_be(expected) should_be_locked spaces = expected[/\A\s+/, 0] || "" expected.gsub!(/^#{spaces}/, '') - bundled_app("Gemfile.lock").read.should == expected + expect(bundled_app("Gemfile.lock").read).to eq(expected) end end end diff --git a/spec/update/gems_spec.rb b/spec/update/gems_spec.rb index 210f48c6d0..d94f4e0560 100644 --- a/spec/update/gems_spec.rb +++ b/spec/update/gems_spec.rb @@ -29,19 +29,19 @@ describe "bundle update" do exit! G bundle "update" - bundled_app("Gemfile.lock").should exist + expect(bundled_app("Gemfile.lock")).to exist end end describe "--quiet argument" do it 'shows UI messages without --quiet argument' do bundle "update" - out.should include("Fetching source") + expect(out).to include("Fetching source") end it 'does not show UI messages with --quiet argument' do bundle "update --quiet" - out.should_not include("Fetching source") + expect(out).not_to include("Fetching source") end end @@ -59,11 +59,11 @@ describe "bundle update" do describe "with a unknown dependency" do it "should inform the user" do bundle "update halting-problem-solver", :expect_err=>true - out.should include "Could not find gem 'halting-problem-solver'" + expect(out).to include "Could not find gem 'halting-problem-solver'" end it "should suggest alternatives" do bundle "update active-support", :expect_err=>true - out.should include "Did you mean activesupport?" + expect(out).to include "Did you mean activesupport?" end end @@ -72,7 +72,7 @@ describe "bundle update" do FileUtils.rm_rf(gem_repo2) bundle "update --local" - out.should_not match(/Fetching source index/) + expect(out).not_to match(/Fetching source index/) end end end @@ -133,13 +133,13 @@ describe "bundle update when a gem depends on a newer version of bundler" do it "should not explode" do bundle "update" - err.should be_empty + expect(err).to be_empty end it "should explain that bundler conflicted" do bundle "update" - out.should_not =~ /in snapshot/i - out.should =~ /current Bundler version/i - out.should =~ /perhaps you need to update bundler/i + expect(out).not_to match(/in snapshot/i) + expect(out).to match(/current Bundler version/i) + expect(out).to match(/perhaps you need to update bundler/i) end end diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb index cd15b5c568..37a0b04b25 100644 --- a/spec/update/git_spec.rb +++ b/spec/update/git_spec.rb @@ -32,7 +32,7 @@ describe "bundle update" do G bundle "update rails" - out.should include("Using activesupport (3.0) from #{lib_path('rails')} (at master)") + expect(out).to include("Using activesupport (3.0) from #{lib_path('rails')} (at master)") should_be_installed "rails 3.0", "activesupport 3.0" end @@ -89,9 +89,9 @@ describe "bundle update" do gem "foo", "1.0", :git => "#{lib_path('foo_two')}" G - err.should be_empty - out.should include("Fetching #{lib_path}/foo_two") - out.should include("Your bundle is complete!") + expect(err).to be_empty + expect(out).to include("Fetching #{lib_path}/foo_two") + expect(out).to include("Your bundle is complete!") end @@ -114,7 +114,7 @@ describe "bundle update" do G bundle "update", :exitstatus => true - exitstatus.should == 0 + expect(exitstatus).to eq(0) end describe "with submodules" do @@ -145,7 +145,7 @@ describe "bundle update" do G run "require 'submodule'" - out.should eq('GEM') + expect(out).to eq('GEM') install_gemfile <<-G git "#{lib_path('has_submodule-1.0')}", :submodules => true do @@ -154,7 +154,7 @@ describe "bundle update" do G run "require 'submodule'" - out.should == 'GIT' + expect(out).to eq('GIT') end it "it unlocks the source when submodules is removed from git source" do @@ -166,7 +166,7 @@ describe "bundle update" do G run "require 'submodule'" - out.should eq('GIT') + expect(out).to eq('GIT') install_gemfile <<-G git "#{lib_path('has_submodule-1.0')}" do @@ -175,7 +175,7 @@ describe "bundle update" do G run "require 'submodule'" - out.should == 'GEM' + expect(out).to eq('GEM') end end @@ -189,7 +189,7 @@ describe "bundle update" do lib_path("foo-1.0").join(".git").rmtree bundle :update, :expect_err => true - out.should include(lib_path("foo-1.0").to_s) + expect(out).to include(lib_path("foo-1.0").to_s) end end diff --git a/spec/update/source_spec.rb b/spec/update/source_spec.rb index 6e4d1b327d..6134c7700c 100644 --- a/spec/update/source_spec.rb +++ b/spec/update/source_spec.rb @@ -28,7 +28,7 @@ describe "bundle update" do puts "WIN" if defined?(FOO_PREV_REF) RUBY - out.should == "WIN" + expect(out).to eq("WIN") end end |