summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-08-10 15:42:51 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-08-16 09:48:27 +0530
commit17e3785ee6419c4c677da61b8155bd457aa1ce86 (patch)
treef912a24c163e411f5c199b799c5140302bc80af1
parent754fed8ead853aa546b798570e8af113c7341e9d (diff)
downloadbundler-17e3785ee6419c4c677da61b8155bd457aa1ce86.tar.gz
Added spec for empty hooks entry in index
-rw-r--r--spec/bundler/plugin/index_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/bundler/plugin/index_spec.rb b/spec/bundler/plugin/index_spec.rb
index 9c962affc6..249628a46e 100644
--- a/spec/bundler/plugin/index_spec.rb
+++ b/spec/bundler/plugin/index_spec.rb
@@ -76,7 +76,7 @@ describe Bundler::Plugin::Index do
end
describe "hook" do
- let(:hooks) { ["before-foo", "after-bar"] }
+ let(:hooks) { ["after-bar"] }
it "returns the plugins name on query" do
expect(index.hook_plugins("after-bar")).to include(plugin_name)
@@ -86,6 +86,23 @@ describe Bundler::Plugin::Index do
new_index = Index.new
expect(new_index.hook_plugins("after-bar")).to eq([plugin_name])
end
+
+ context "that are not registered", :focused do
+ let(:file) { double("index-file") }
+
+ before do
+ index.hook_plugins("not-there")
+ allow(File).to receive(:open).and_yield(file)
+ end
+
+ it "should not save it with next registed hook" do
+ expect(file).to receive(:puts) do |content|
+ expect(content).not_to include("not-there")
+ end
+
+ index.register_plugin("aplugin", lib_path("aplugin").to_s, lib_path("aplugin").join("lib").to_s, [], [], [])
+ end
+ end
end
describe "global index" do