class TagListAction
TagListAction - prints out the
descriptions for any specs tagged with tags
. If
tags
is an empty list, prints out descriptions for any specs
that are tagged.
Public Class Methods
new(tags=nil)
click to toggle source
# File lib/mspec/runner/actions/taglist.rb, line 7 def initialize(tags=nil) @tags = tags.nil? || tags.empty? ? nil : Array(tags) @filter = nil end
Public Instance Methods
===(string)
click to toggle source
Returns true if any tagged descriptions matches string
.
# File lib/mspec/runner/actions/taglist.rb, line 19 def ===(string) @filter === string end
after(state)
click to toggle source
Prints the spec description if it matches the filter.
# File lib/mspec/runner/actions/taglist.rb, line 40 def after(state) return unless self === state.description print state.description, "\n" end
include?(arg)
click to toggle source
Returns true. This enables us to match any tag when loading tags from the file.
# File lib/mspec/runner/actions/taglist.rb, line 14 def include?(arg) true end
load()
click to toggle source
Creates a MatchFilter for specific tags or for all tags.
# File lib/mspec/runner/actions/taglist.rb, line 33 def load @filter = nil desc = MSpec.read_tags(@tags || self).map { |t| t.description } @filter = MatchFilter.new(nil, *desc) unless desc.empty? end
register()
click to toggle source
# File lib/mspec/runner/actions/taglist.rb, line 45 def register MSpec.register :start, self MSpec.register :load, self MSpec.register :after, self end
start()
click to toggle source
Prints a banner about matching tagged specs.
# File lib/mspec/runner/actions/taglist.rb, line 24 def start if @tags print "\nListing specs tagged with #{@tags.map { |t| "'#{t}'" }.join(", ") }\n\n" else print "\nListing all tagged specs\n\n" end end
unregister()
click to toggle source
# File lib/mspec/runner/actions/taglist.rb, line 51 def unregister MSpec.unregister :start, self MSpec.unregister :load, self MSpec.unregister :after, self end