diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/settings_spec.rb | 6 | ||||
-rw-r--r-- | spec/bundler/source_list_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/newgem_spec.rb | 52 | ||||
-rw-r--r-- | spec/install/gems/sources_spec.rb | 20 |
4 files changed, 71 insertions, 9 deletions
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb index 0faaa3f5..56ee87da 100644 --- a/spec/bundler/settings_spec.rb +++ b/spec/bundler/settings_spec.rb @@ -43,5 +43,11 @@ describe Bundler::Settings do settings["local.httpsmarty"] = home("httpsmarty") expect(settings.all).to include("local.httpsmarty") end + + it "reads older keys without trailing slashes" do + settings["mirror.https://rubygems.org"] = "http://rubygems-mirror.org" + expect(settings.gem_mirrors).to eq(URI("https://rubygems.org/") => URI("http://rubygems-mirror.org/")) + end + end end diff --git a/spec/bundler/source_list_spec.rb b/spec/bundler/source_list_spec.rb index b3e18863..f5a8575a 100644 --- a/spec/bundler/source_list_spec.rb +++ b/spec/bundler/source_list_spec.rb @@ -91,7 +91,7 @@ describe Bundler::SourceList do end it "returns the aggregate rubygems source" do - expect(@returned_source).to be_instance_of(Bundler::Source::LocalRubygems) + expect(@returned_source).to be_instance_of(Bundler::Source::Rubygems) end it "adds the provided remote to the beginning of the aggregate source" do diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index f775f81b..c8c5bf59 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -1,6 +1,7 @@ require "spec_helper" describe "bundle gem" do + def reset! super global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false" @@ -154,10 +155,6 @@ describe "bundle gem" do to match("delete to allow pushes to any server") end - it "sets gemspec license to MIT by default" do - expect(generated_gem.gemspec.license).to eq("MIT") - end - it "requires the version file" do expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/require "test_gem\/version"/) end @@ -332,6 +329,9 @@ describe "bundle gem" do 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 + + skel = Bundler::GemHelper.new(bundled_app(gem_name).to_s) + expect(skel.gemspec.license).to eq("MIT") end end @@ -402,10 +402,6 @@ describe "bundle gem" do to match("delete to allow pushes to any server") end - it "sets gemspec license to MIT by default" do - expect(generated_gem.gemspec.license).to eq("MIT") - end - it "requires the version file" do expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/require "test\/gem\/version"/) end @@ -581,4 +577,44 @@ describe "bundle gem" do end end end + + context "on first run" do + before do + in_app_root + end + + it "asks about test framework" do + global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__COC" => "false" + + bundle "gem foobar" do |input| + input.puts "rspec" + end + + expect(bundled_app("foobar/spec/spec_helper.rb")).to exist + end + + it "asks about MIT license" do + global_config "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false" + + bundle :config + + bundle "gem foobar" do |input| + input.puts "yes" + end + + expect(bundled_app("foobar/LICENSE.txt")).to exist + end + + it "asks about CoC" do + global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false" + + + bundle "gem foobar" do |input| + input.puts "yes" + end + + expect(bundled_app("foobar/CODE_OF_CONDUCT.md")).to exist + end + end + end diff --git a/spec/install/gems/sources_spec.rb b/spec/install/gems/sources_spec.rb index 45a742a8..cca00a91 100644 --- a/spec/install/gems/sources_spec.rb +++ b/spec/install/gems/sources_spec.rb @@ -281,6 +281,26 @@ describe "bundle install with gems on multiple sources" do should_be_installed("rack 0.9.1") end end + + context "with a path gem in the same Gemfile" do + before do + build_lib "foo" + + gemfile <<-G + gem "rack", :source => "file://#{gem_repo1}" + gem "foo", :path => "#{lib_path('foo-1.0')}" + G + end + + it "does not unlock the non-path gem after install" do + bundle :install + + bundle %{exec ruby -e 'puts "OK"'} + + expect(out).to include("OK") + expect(exitstatus).to eq(0) if exitstatus + end + end end context "when an older version of the same gem also ships with Ruby" do |