Class: Apivore::AllRoutesTestedValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/apivore/all_routes_tested_validator.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject


17
18
19
# File 'lib/apivore/all_routes_tested_validator.rb', line 17

def description
  "have tested all documented routes"
end

#failure_messageObject


21
22
23
# File 'lib/apivore/all_routes_tested_validator.rb', line 21

def failure_message
  @errors.join("\n")
end

#matches?(swagger_checker) ⇒ Boolean

Returns:

  • (Boolean)

4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/apivore/all_routes_tested_validator.rb', line 4

def matches?(swagger_checker)
  @errors = []
  swagger_checker.untested_mappings.each do |path, methods|
    methods.each do |method, codes|
      codes.each do |code, _|
        @errors << "#{method} #{path} is untested for response code #{code}"
      end
    end
  end

  @errors.empty?
end