Raise exception if the insert_before middleware is not found
This commit is contained in:
parent
879f98b5d5
commit
3d147f1d96
|
@ -57,6 +57,7 @@ module Vagrant
|
|||
# given middleware object.
|
||||
def insert(index, middleware, *args, &block)
|
||||
index = self.index(index) unless index.is_a?(Integer)
|
||||
raise "no such middleware to insert before: #{index.inspect}" unless index
|
||||
stack.insert(index, [middleware, args, block])
|
||||
end
|
||||
|
||||
|
|
|
@ -113,7 +113,12 @@ describe Vagrant::Action::Builder do
|
|||
data[:data].should == [1, 2, 3]
|
||||
end
|
||||
|
||||
it "raises an exception if an invalid object given" do
|
||||
it "raises an exception if an invalid object given for insert" do
|
||||
expect { instance.insert "object", appender_proc(1) }.
|
||||
to raise_error(RuntimeError)
|
||||
end
|
||||
|
||||
it "raises an exception if an invalid object given for insert_after" do
|
||||
expect { instance.insert_after "object", appender_proc(1) }.
|
||||
to raise_error(RuntimeError)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue