spec/kitchen/transport_spec.rb in test-kitchen-1.14.1 vs spec/kitchen/transport_spec.rb in test-kitchen-1.14.2

- old
+ new

@@ -23,18 +23,15 @@ require "kitchen/logging" require "kitchen/transport" require "kitchen/transport/base" module Kitchen - module Transport - class Coolbeans < Kitchen::Transport::Base end class ItDepends < Kitchen::Transport::Base - attr_reader :verify_call_count def initialize(config = {}) @verify_call_count = 0 super @@ -44,22 +41,19 @@ @verify_call_count += 1 end end class UnstableDepends < Kitchen::Transport::Base - def verify_dependencies raise UserError, "Oh noes, you don't have software!" end end end end describe Kitchen::Transport do - describe ".for_plugin" do - before do Kitchen::Transport.stubs(:require).returns(true) end it "returns a transport object of the correct class" do @@ -67,11 +61,11 @@ transport.must_be_kind_of Kitchen::Transport::Coolbeans end it "returns a transport initialized with its config" do - transport = Kitchen::Transport.for_plugin("coolbeans", :foo => "bar") + transport = Kitchen::Transport.for_plugin("coolbeans", foo: "bar") transport[:foo].must_equal "bar" end it "calls #verify_dependencies on the transport object" do @@ -90,23 +84,23 @@ end it "raises ClientError if the transport could not be required" do Kitchen::Transport.stubs(:require).raises(LoadError) - proc { Kitchen::Transport.for_plugin("coolbeans", {}) }. - must_raise Kitchen::ClientError + proc { Kitchen::Transport.for_plugin("coolbeans", {}) } + .must_raise Kitchen::ClientError end it "raises ClientError if the transport's class constant was not found" do # pretend require worked Kitchen::Transport.stubs(:require).returns(true) - proc { Kitchen::Transport.for_plugin("nope", {}) }. - must_raise Kitchen::ClientError + proc { Kitchen::Transport.for_plugin("nope", {}) } + .must_raise Kitchen::ClientError end it "raises UserError if #verify_dependencies failes" do - proc { Kitchen::Transport.for_plugin("unstable_depends", {}) }. - must_raise Kitchen::UserError + proc { Kitchen::Transport.for_plugin("unstable_depends", {}) } + .must_raise Kitchen::UserError end end end