Class: Minitest::Checks::Base

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

Direct Known Subclasses

Controllers, Models

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



16
17
18
# File 'lib/mimoco.rb', line 16

def klass
  @klass
end

#klass_hashObject

Returns the value of attribute klass_hash.



16
17
18
# File 'lib/mimoco.rb', line 16

def klass_hash
  @klass_hash
end

#minitestObject

Returns the value of attribute minitest.



16
17
18
# File 'lib/mimoco.rb', line 16

def minitest
  @minitest
end

#whereObject

Returns the value of attribute where.



16
17
18
# File 'lib/mimoco.rb', line 16

def where
  @where
end

Class Method Details

.check_equal(expected, actual, msg = nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/mimoco.rb', line 30

def self.check_equal(expected, actual, msg = nil)
  expected = expected.sort.map(&:to_sym)
  actual = actual.sort.map(&:to_sym)
  msg = msg ? "#{@where}: #{msg}" : @where
  @minitest.assert_equal expected, actual, msg
end

.check_no_nil(actual, msg = nil) ⇒ Object



37
38
39
40
# File 'lib/mimoco.rb', line 37

def self.check_no_nil(actual, msg = nil)
  msg = msg ? "#{@where}: #{msg}" : @where
  @minitest.refute_nil actual, msg
end

.run(data, minitest) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mimoco.rb', line 18

def self.run(data, minitest)
  @minitest = minitest
  data.each do |klass, hash|
    @klass = klass
    @klass_hash = hash
    hash.each do |function, value|
      @where = "#{klass}##{function}"
      send(function, value)
    end
  end
end