Permalink
Browse files

Extracted guards to the method where they matter

  • Loading branch information...
1 parent 61bd422 commit 9de3365df48cfd1b08ec9a9bf3c19d0ae5519c45 @elight committed Dec 5, 2010
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/coulda.rb
View
@@ -18,10 +18,7 @@ def Tag(name)
# Factory method for Test::Unit::TestCase subclasses
def Feature(name, opts = {}, &block)
- unless @processed_cmd_line_args
- @processed_cmd_line_args = true
- process_command_line_tags
- end
+ process_command_line_tags
if @requested_tags && !@requested_tags.empty?
if @feature_tags.nil? || !@feature_tags.any? { |f_tag| @requested_tags.include? f_tag}
@@ -63,8 +60,11 @@ def assign_class_to_const(test_class, potential_const)
end
def process_command_line_tags
- tags = ARGV.inject([]) { |m, a| m << a if a =~ /^tags=/; m }
- @requested_tags = tags.map { |t| t.split("=")[1].split(",") }.flatten
+ unless @processed_cmd_line_args
+ @processed_cmd_line_args = true
+ tags = ARGV.inject([]) { |m, a| m << a if a =~ /^tags=/; m }
+ @requested_tags = tags.map { |t| t.split("=")[1].split(",") }.flatten
+ end
end
end

0 comments on commit 9de3365

Please sign in to comment.