Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colored output #15

Closed
whitequark opened this issue Dec 23, 2012 · 3 comments
Closed

Colored output #15

whitequark opened this issue Dec 23, 2012 · 3 comments

Comments

@whitequark
Copy link

I use this module for my tests, and find the output much more readable:

module Bacon
  module ColoredOutput
    def handle_specification(name)
      puts spaces + name
      yield
      puts if Counter[:context_depth] == 1
    end

    def handle_requirement(description)
      print spaces

      error = yield

      print error.empty? ? "\e[32m" : "\e[1;31m"
      print "  - #{description}"
      puts error.empty? ? "\e[0m" : " [#{error}]\e[0m"
    end

    def handle_summary
      print ErrorLog  if Backtraces
      puts "%d specifications (%d requirements), %d failures, %d errors" %
        Counter.values_at(:specifications, :requirements, :failed, :errors)
    end

    def spaces
      "  " * (Counter[:context_depth] - 1)
    end
  end

  extend ColoredOutput
end

example

Would you like to integrate it?

@leahneukirchen
Copy link
Owner

I hate coloring, so no, but you can just put it into a seperate file. (And inherit SpecDoxOutput, even.)

@leahneukirchen
Copy link
Owner

Also, see http://rubygems.org/gems/Bacon_Colored

@whitequark
Copy link
Author

Haha, I just made another one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants