Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit ec4878e

Browse files
committed
Add unit test for previous commit
1 parent f9c0e99 commit ec4878e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
require "spec_helper"
3+
require "bundler/installer/gem_installer"
4+
5+
RSpec.describe Bundler::GemInstaller do
6+
let(:installer) { instance_double("Installer") }
7+
let(:spec_source) { instance_double("SpecSource") }
8+
let(:spec) { instance_double("Specification", :name => "dummy", :version => "0.0.1", :loaded_from => "dummy", :source => spec_source) }
9+
10+
subject { described_class.new(spec, installer) }
11+
12+
context "spec_settings is nil" do
13+
it "invokes install method with empty build_args" do
14+
allow(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => [])
15+
subject.install_from_spec
16+
end
17+
end
18+
19+
context "spec_settings is build option" do
20+
it "invokes install method with build_args" do
21+
allow(Bundler.settings).to receive(:[]).with(:bin)
22+
allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy")
23+
allow(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy"])
24+
subject.install_from_spec
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)