Sha256: 80e4d5413126c3a6d59836a1d90483fbd8bb2ee431d80768cfef3a859679f8a3

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

require "tester/modules/format"
require 'tester/modules/good_case'
require 'tester/modules/unused_fields'
require 'tester/modules/typo'
require 'rest-client'
require 'json'

class ApiTester
  attr_accessor :report
  attr_accessor :modules
  attr_accessor :definition
  attr_accessor :test_helper

  def initialize(definition)
    self.report = ApiReport.new
    self.modules = []
    self.definition = definition
    self.test_helper = TestHelper.new
  end

  def with_module(new_module)
    self.modules << new_module
    self
  end

  def with_reporter(reporter)
    self.report = reporter
    self
  end

  def with_default_modules
    self.modules << Format.new
    self.modules << GoodCase.new
    self.modules << Typo.new
    self.modules << UnusedFields.new
    self
  end

  def go
    self.modules.sort_by{ |mod| mod.order }.each do |mod|
      mod.go self.definition, self.report
    end

    self.report.print
    self.report.reports.size == 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api-tester-0.0.4 lib/tester/api_tester.rb