module RSpec::Apib
Constants
- VERSION
Public Class Methods
config()
click to toggle source
# File lib/rspec/apib.rb, line 17 def config @config || configure end
configure() { |config| ... }
click to toggle source
# File lib/rspec/apib.rb, line 11 def configure @config = Configuration.new yield(@config) if block_given? @config end
connection()
click to toggle source
# File lib/rspec/apib.rb, line 21 def connection Connection.instance end
record(example, request, response, routes)
click to toggle source
# File lib/rspec/apib.rb, line 39 def record(example, request, response, routes) @_doc ||= {} recorder = Recorder.new(example, request, response, routes, @_doc) recorder.run end
record?(example)
click to toggle source
# File lib/rspec/apib.rb, line 50 def record?(example) default_recording_policy = config.default_recording_policy config.record_types.include?(example.metadata[:type]) && ( default_recording_policy && !(example.metadata[:apib] === false) || !default_recording_policy && (example.metadata[:apib] === true) ) end
start()
click to toggle source
# File lib/rspec/apib.rb, line 25 def start RSpec.configure do |config| config.after :each do |example| if RSpec::Apib.record?(example) RSpec::Apib.record(example, request, response, @routes) end end config.after :all do |example| RSpec::Apib.write end end end
write()
click to toggle source
# File lib/rspec/apib.rb, line 45 def write writer = Writer.new(@_doc || {}) writer.write end