wip:swagger-based dsl for rspec

This commit is contained in:
domaindrivendev
2016-03-09 16:58:38 -08:00
parent fc877b4047
commit d579dab7d8
12 changed files with 246 additions and 195 deletions

View File

@@ -0,0 +1,37 @@
require 'rspec/core/formatters/base_text_formatter'
module SwaggerRails
module RSpec
class Formatter
::RSpec::Core::Formatters.register self,
:example_group_started,
:example_group_finished,
:stop
def initialize(output)
@output = output
@swagger_docs = {}
@group_level = 0
@output.puts 'Generating Swagger Docs ...'
end
def example_group_started(notification)
@group_level += 1
group = notification.group
metadata = group.metadata
@output.puts "group_level: #{@group_level}"
@output.puts metadata.slice(:doc, :path_template, :operation, :response).inspect
end
def example_group_finished(notification)
@group_level -= 1
end
def stop(notification)
end
end
end
end