summaryrefslogtreecommitdiff
path: root/spec/bundler/definition_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/definition_spec.rb')
-rw-r--r--spec/bundler/definition_spec.rb59
1 files changed, 43 insertions, 16 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