class Less::Expectation

Attributes

parameter[R]

Public Class Methods

new(parameter, options = {}) click to toggle source
# File lib/less_interactions/expectation.rb, line 5
def initialize parameter, options = {}
  @parameter = parameter
  @allow_nil = options[:allow_nil]
end

Public Instance Methods

allows_nil?() click to toggle source
# File lib/less_interactions/expectation.rb, line 16
def allows_nil?
  @allow_nil
end
verify(params) click to toggle source
# File lib/less_interactions/expectation.rb, line 10
def verify(params)
  unless verifies_expectations?(params)
    raise MissingParameterError, "Parameter empty  :#{@parameter}"
  end
end

Private Instance Methods

verifies_expectations?(params) click to toggle source
# File lib/less_interactions/expectation.rb, line 22
def verifies_expectations?(params)
  if @allow_nil == nil || @allow_nil == false
    params.has_key?(@parameter) && params[@parameter] != nil
  else
    true
  end
end