module MiniApivore

Constants

FORBIDDEN
NOT_AUTHORIZED
NOT_FOUND
NO_CONTENT
OK
SWAGGER_CHECKERS
UNPROCESSABLE_ENTITY

Public Class Methods

all_test_ran?() click to toggle source
# File lib/mini_apivore.rb, line 14
def self.all_test_ran?; runnable_list.empty? end
included(base) click to toggle source
# File lib/mini_apivore.rb, line 30
def self.included(base)
  base.extend ClassMethods
  base.include MiniApivore::Validation
end
prepare_untested_errors() click to toggle source
# File lib/mini_apivore.rb, line 16
def self.prepare_untested_errors
  errors = []
  SWAGGER_CHECKERS.each do |cls, chkr|
    chkr.untested_mappings.each do |path, methods|
      methods.each do |method, codes|
        codes.each do |code, _|
          errors << "#{method} #{path} is untested for response code #{code} in test class #{cls.to_s}"
        end
      end
    end
  end
  errors
end
runnable_list() click to toggle source
# File lib/mini_apivore.rb, line 13
def self.runnable_list; @@runnable_list ||= []  end

Public Instance Methods

final_test() click to toggle source
# File lib/mini_apivore.rb, line 62
def final_test
  return unless MiniApivore.all_test_ran?

  @errors = MiniApivore.prepare_untested_errors
  assert( @errors.empty?, @errors.join("\n") )

  # preventing duplicate execution
  MiniApivore.runnable_list << "#{self.class.to_s}::#{__method__}_runned"
end
teardown() click to toggle source
Calls superclass method
# File lib/mini_apivore.rb, line 56
def teardown
  super
  MiniApivore.runnable_list.delete( "#{self.class.to_s}::#{@NAME}" )
end