lib/dox/formatter.rb in dox-1.3.0 vs lib/dox/formatter.rb in dox-2.0.0.beta1
- old
+ new
@@ -18,19 +18,20 @@
move_example_to_passed if current_example.document?
end
def stop(notification)
if notification.failed_examples.any?
- $stderr.puts(notification.fully_formatted_failed_examples)
+ warn(notification.fully_formatted_failed_examples)
else
printer.print(passed_examples)
end
end
def dump_summary(summary)
return if summary.failed_examples.none?
- $stderr.puts(summary.fully_formatted)
+
+ warn(summary.fully_formatted)
exit(-1)
end
private
@@ -42,31 +43,29 @@
group = passed_examples[group_name]
if group
group.tap { |g| g.desc ||= current_example.resource_group_desc }
else
- passed_examples[group_name] = Entities::ResourceGroup.new(group_name,
- current_example.metadata)
+ passed_examples[group_name] = Entities::ResourceGroup.new(current_example.metadata)
end
end
def load_or_save_resource_to_group(group)
- resource_name = current_example.resource_name
- group.resources[resource_name] ||= Entities::Resource.new(resource_name,
- current_example.metadata)
+ group.resources[current_example.resource_name] ||= Entities::Resource.new(current_example.metadata)
end
def load_or_save_action_to_resource(resource)
- action_name = current_example.action_name
- resource.actions[action_name] ||= Entities::Action.new(action_name, current_example.metadata,
- current_example.request)
+ resource.actions[current_example.action_name] ||= Entities::Action.new(current_example.metadata,
+ current_example.request)
end
def move_example_to_passed
group = load_or_save_group
resource = load_or_save_resource_to_group(group)
action = load_or_save_action_to_resource(resource)
- action.examples << Entities::Example.new(current_example.metadata, current_example.request, current_example.response)
+ action.examples << Entities::Example.new(current_example.metadata,
+ current_example.request,
+ current_example.response)
end
def printer
@printer ||= Printers::DocumentPrinter.new(output)
end