aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/bundler/spec_set_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/bundler/spec_set_spec.rb')
-rw-r--r--spec/bundler/bundler/spec_set_spec.rb40
1 files changed, 37 insertions, 3 deletions
diff --git a/spec/bundler/bundler/spec_set_spec.rb b/spec/bundler/bundler/spec_set_spec.rb
index 8f7c27f065..6fedd38b50 100644
--- a/spec/bundler/bundler/spec_set_spec.rb
+++ b/spec/bundler/bundler/spec_set_spec.rb
@@ -1,5 +1,4 @@
# frozen_string_literal: true
-require "spec_helper"
RSpec.describe Bundler::SpecSet do
let(:specs) do
@@ -17,6 +16,7 @@ RSpec.describe Bundler::SpecSet do
build_spec("e", "1.0.0.pre.1"),
].flatten
end
+
subject { described_class.new(specs) }
context "enumerable methods" do
@@ -29,15 +29,49 @@ RSpec.describe Bundler::SpecSet do
end
end
+ describe "#find_by_name_and_platform" do
+ let(:platform) { Gem::Platform.new("universal-darwin-64") }
+ let(:platform_spec) { build_spec("b", "2.0", platform).first }
+ let(:specs) do
+ [
+ build_spec("a", "1.0"),
+ platform_spec,
+ ].flatten
+ end
+
+ it "finds spec with given name and platform" do
+ spec = described_class.new(specs).find_by_name_and_platform("b", platform)
+ expect(spec).to eq platform_spec
+ end
+ end
+
+ describe "#merge" do
+ let(:other_specs) do
+ [
+ build_spec("f", "1.0"),
+ build_spec("g", "2.0"),
+ ].flatten
+ end
+
+ let(:other_spec_set) { described_class.new(other_specs) }
+
+ it "merges the items in each gemspec" do
+ new_spec_set = subject.merge(other_spec_set)
+ specs = new_spec_set.to_a.map(&:full_name)
+ expect(specs).to include("a-1.0")
+ expect(specs).to include("f-1.0")
+ end
+ end
+
describe "#to_a" do
it "returns the specs in order" do
- expect(subject.to_a.map(&:full_name)).to eq %w(
+ expect(subject.to_a.map(&:full_name)).to eq %w[
a-1.0
b-1.0
e-1.0.0.pre.1
c-1.1
d-2.0
- )
+ ]
end
end
end