Class: Applitools::Selenium::TestList

Inherits:
Array
  • Object
show all
Defined in:
lib/applitools/selenium/test_list.rb

Instance Method Summary collapse

Instance Method Details

#<<(value) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/applitools/selenium/test_list.rb', line 6

def <<(value)
  unless value.is_a? Applitools::Selenium::RunningTest
    raise(
      Applitools::EyesIllegalArgument,
      "Expected value to be instance of Applitools::Selenium::RunningTest but got #{value.class} instead"
    )
  end
  super
end

#push(*args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/applitools/selenium/test_list.rb', line 16

def push(*args)
  wrong_values = args.select { |a| !a.is_a? Applitools::Selenium::RunningTest }
  unless wrong_values.empty?
    raise(
      Applitools::EyesIllegalArgument,
      'Expected values to contain only Applitools::Selenium::RunningTest instances, ' \
      "but got [#{wrong_values.map(&:class).join(', ')}]"
    )
  end
  super
end