diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/definition_spec.rb | 59 | ||||
-rw-r--r-- | spec/commands/outdated_spec.rb | 10 |
2 files changed, 48 insertions, 21 deletions
diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index 470b4437f5..1bd6575d8b 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -225,26 +225,53 @@ describe Bundler::Definition do expect(locked.include?("shared_dep")).to be_truthy end end + end + end + + describe "find_resolved_spec" do + it "with no platform set in SpecSet" do + ss = Bundler::SpecSet.new([build_stub_spec("a", "1.0"), build_stub_spec("b", "1.0")]) + dfn = Bundler::Definition.new(nil, [], mock_source_list, true) + dfn.instance_variable_set("@specs", ss) + found = dfn.find_resolved_spec(build_spec("a", "0.9", "ruby").first) + expect(found.name).to eq "a" + expect(found.version.to_s).to eq "1.0" + end + end - def mock_source_list - Class.new do - def all_sources - [] - end + describe "find_indexed_specs" do + it "with no platform set in indexed specs" do + index = Bundler::Index.new + %w(1.0.0 1.0.1 1.1.0).each {|v| index << build_stub_spec("foo", v) } - def path_sources - [] - end + dfn = Bundler::Definition.new(nil, [], mock_source_list, true) + dfn.instance_variable_set("@index", index) + found = dfn.find_indexed_specs(build_spec("foo", "0.9", "ruby").first) + expect(found.length).to eq 3 + end + end - def rubygems_remotes - [] - end + def build_stub_spec(name, version) + Bundler::StubSpecification.new(name, version, nil, nil) + end - def replace_sources!(arg) - nil - end - end.new + def mock_source_list + Class.new do + def all_sources + [] end - end + + def path_sources + [] + end + + def rubygems_remotes + [] + end + + def replace_sources!(arg) + nil + end + end.new end end diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb index b3d9a97b82..a3e46a4e7f 100644 --- a/spec/commands/outdated_spec.rb +++ b/spec/commands/outdated_spec.rb @@ -607,17 +607,17 @@ describe "bundle outdated" do it "shows all gems when patching and filtering to patch" do bundle "outdated --patch --filter-patch" - expect(out).to include("patch (newest") - expect(out).to include("minor (newest") - expect(out).to include("major (newest") + expect(out).to include("patch (newest 1.0.1") + expect(out).to include("minor (newest 1.0.1") + expect(out).to include("major (newest 1.0.1") end it "shows minor and major when updating to minor and filtering to patch and minor" do bundle "outdated --minor --filter-minor" expect(out).not_to include("patch (newest") - expect(out).to include("minor (newest") - expect(out).to include("major (newest") + expect(out).to include("minor (newest 1.1.0") + expect(out).to include("major (newest 1.1.0") end it "shows minor when updating to major and filtering to minor with parseable" do |