Class: Concordion::ErrorCondition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected, actual, xpath, context = nil, assert_true_command = false) ⇒ ErrorCondition

Returns a new instance of ErrorCondition.



8
9
10
11
12
13
14
# File 'lib/concordion/error_condition.rb', line 8

def initialize(expected, actual, xpath, context = nil, assert_true_command = false)
  @expected = expected
  @actual = actual
  @xpath = xpath
  @context = context
  @assert_true_command = assert_true_command
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



7
8
9
# File 'lib/concordion/error_condition.rb', line 7

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



7
8
9
# File 'lib/concordion/error_condition.rb', line 7

def expected
  @expected
end

Instance Method Details

#to_sObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/concordion/error_condition.rb', line 16

def to_s
  @expected = "true" if @assert_true_command
  
  base = "expected (#{@expected}) but got (#{@actual}) in tag: #{@xpath}"


  return base if @context.nil?

  base + "\n\tcontext of error: #{@context}"
end