Module: Canql::Nodes::TestAcceptanceExistamce::WithCondition

Defined in:
lib/canql/nodes/test_result_group.rb

Instance Method Summary collapse

Instance Method Details

#existance_filterObject



53
54
55
56
57
58
59
# File 'lib/canql/nodes/test_result_group.rb', line 53

def existance_filter
  {
    Canql::EQUALS => ['supplied required', 'supplied'].include?(
      existance_modifier.text_value.strip
    )
  }
end

#requirement_filterObject



61
62
63
64
65
66
67
# File 'lib/canql/nodes/test_result_group.rb', line 61

def requirement_filter
  {
    Canql::EQUALS => ['supplied required', 'missing required'].include?(
      existance_modifier.text_value.strip
    )
  }
end

#test_acceptanceObject



42
43
44
# File 'lib/canql/nodes/test_result_group.rb', line 42

def test_acceptance
  acceptance.text_value.strip.parameterize.underscore
end

#test_acceptance_filterObject



69
70
71
# File 'lib/canql/nodes/test_result_group.rb', line 69

def test_acceptance_filter
  { Canql::EQUALS => test_acceptance }
end

#to_test_acceptanceObject



46
47
48
49
50
51
# File 'lib/canql/nodes/test_result_group.rb', line 46

def to_test_acceptance
  test_acceptance_hash = { 'exists' => existance_filter }
  test_acceptance_hash['required'] = requirement_filter
  test_acceptance_hash['acceptance'] = test_acceptance_filter if test_acceptance.present?
  test_acceptance_hash
end