Sha256: b599753103ab11bae500355423882b3ed5415ba3881b0f2628f737304b4e8f9f
Contents?: true
Size: 1.43 KB
Versions: 30
Compression:
Stored size: 1.43 KB
Contents
# -*- encoding: utf-8 -*- # # Author:: Fletcher Nichol (<fnichol@nichol.ca>) # # Copyright (C) 2014, Fletcher Nichol # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require_relative "../spec_helper" require "kitchen/logging" class LoggingDummy include Kitchen::Logging attr_reader :logger def initialize(logger) @logger = logger end class Logger METHODS = [:banner, :debug, :info, :warn, :error, :fatal] attr_reader(*(METHODS.map { |m| "#{m}_msg".to_sym })) METHODS.each do |meth| define_method(meth) do |*args| instance_variable_set("@#{meth}_msg", args.first) end end end end describe Kitchen::Logging do let(:logger) { LoggingDummy::Logger.new } let(:subject) { LoggingDummy.new(logger) } LoggingDummy::Logger::METHODS.each do |meth| it "##{meth} calls method on logger" do subject.public_send(meth, "ping") logger.public_send("#{meth}_msg").must_equal "ping" end end end
Version data entries
30 entries across 30 versions & 1 rubygems