blob: be23db3bbacd02bb4f002074febaa1c22706437c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# frozen_string_literal: true
RSpec.describe Bundler::Plugin::DSL do
DSL = Bundler::Plugin::DSL
subject(:dsl) { Bundler::Plugin::DSL.new }
before do
allow(Bundler).to receive(:root) { Pathname.new "/" }
end
describe "it ignores only the methods defined in Bundler::Dsl" do
it "doesn't raises error for Dsl methods" do
expect { dsl.install_if }.not_to raise_error
end
it "raises error for other methods" do
expect { dsl.no_method }.to raise_error(DSL::PluginGemfileError)
end
end
describe "source block" do
it "adds #source with :type to list and also inferred_plugins list" do
expect(dsl).to receive(:plugin).with("bundler-source-news").once
dsl.source("some_random_url", :type => "news") {}
expect(dsl.inferred_plugins).to eq(["bundler-source-news"])
end
it "registers a source type plugin only once for multiple declataions" do
expect(dsl).to receive(:plugin).with("bundler-source-news").and_call_original.once
dsl.source("some_random_url", :type => "news") {}
dsl.source("another_random_url", :type => "news") {}
end
end
end
|