lib/assert/view_helpers.rb in assert-2.17.0 vs lib/assert/view_helpers.rb in assert-2.18.0

- old
+ new

@@ -1,35 +1,30 @@ require "assert/config_helpers" module Assert - module ViewHelpers - def self.included(receiver) receiver.class_eval do include Assert::ConfigHelpers extend ClassMethods include InstanceMethods end end module ClassMethods - def option(name, *default_vals) default = default_vals.size > 1 ? default_vals : default_vals.first define_method(name) do |*args| if !(value = args.size > 1 ? args : args.first).nil? instance_variable_set("@#{name}", value) end (val = instance_variable_get("@#{name}")).nil? ? default : val end end - end module InstanceMethods - # show any captured output def captured_output(output) "--- stdout ---\n"\ "#{output}"\ "--------------" @@ -84,17 +79,14 @@ summary_msg = self.result_summary_msg(result_type) block_given? ? yield(summary_msg, result_type) : summary_msg end self.to_sentence(summaries) end - end module Ansi - # Table of supported styles/codes (http://en.wikipedia.org/wiki/ANSI_escape_code) - CODES = { :clear => 0, :reset => 0, :bright => 1, :bold => 1, @@ -180,11 +172,8 @@ return msg if !self.is_tty? || !self.styled code = Assert::ViewHelpers::Ansi.code_for(*self.send("#{result_type}_styles")) return msg if code.empty? code + msg + Assert::ViewHelpers::Ansi.code_for(:reset) end - end - end - end