Sha256: d5f44e5ee06ec58df6469a08ae0d90f1ac9224c0086bd89e1f78c7c112b9ea72
Contents?: true
Size: 1.01 KB
Versions: 72
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' require 'r10k/action/visitor' require 'r10k/logging' describe R10K::Action::Visitor do let(:visitor_class) do Class.new do include R10K::Action::Visitor include R10K::Logging attr_accessor :trace def visit_error(other) raise ArgumentError, "no soup for you" end end end subject { visitor_class.new } it "dispatches visit invocations to the type specific method" do expect(subject).to receive(:visit_sym).with(:hi) subject.visit(:sym, :hi) end describe "when a visit_ method raises an error" do [true, false].each do |trace| msg = trace ? "a" : "no" it "logs the error with #{msg} backtrace when trace is #{trace}" do subject.trace = trace expect(R10K::Errors::Formatting).to( receive(:format_exception).with(instance_of(ArgumentError), trace) ).and_return("errmsg") expect(subject.logger).to receive(:error).with('errmsg') subject.visit(:error, :hi) end end end end
Version data entries
72 entries across 72 versions & 2 rubygems