Class: Spectro::Spec::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/spectro/spec/rule.rb

Overview

Assert representation based on input params and an expected output. Meant to be used against an algorith to test its behavior.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, output) ⇒ Rule

Returns a new instance of Rule

Parameters:

  • parmas (<Object>)

    set of input params

  • output (<Object>)

    expected result



13
14
15
16
# File 'lib/spectro/spec/rule.rb', line 13

def initialize params, output
  self.output = output
  self.params = params
end

Instance Attribute Details

#outputObject

Returns the value of attribute output



9
10
11
# File 'lib/spectro/spec/rule.rb', line 9

def output
  @output
end

#paramsObject

Returns the value of attribute params



9
10
11
# File 'lib/spectro/spec/rule.rb', line 9

def params
  @params
end

Instance Method Details

#==(rule) ⇒ Object



18
19
20
21
22
# File 'lib/spectro/spec/rule.rb', line 18

def == rule
  return \
    self.output == rule.output && \
    self.params == rule.params
end