class Screenplay::TestActor
Public Instance Methods
play(params, input)
click to toggle source
# File lib/screenplay/actors/test.rb, line 31 def play(params, input) params.each { | key, values | values.each { | test, b | expects = !test.to_s.start_with?('not-') test = test.to_s[4..-1] unless expects method = "test_#{test}".to_sym raise UnknownTestException.new(test) if !respond_to?(method) a = input.get_value_from_path(key) raise TestFailedException.new(test, a, b) unless (public_send(method, a, b) == expects) } } return input end
test_eq(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 53 def test_eq(a, b) a === b end
test_gt(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 61 def test_gt(a, b) a > b end
test_gte(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 57 def test_gte(a, b) a >= b end
test_in(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 65 def test_in(a, b) if (b.is_a?(String)) b.index(a) != nil elsif (b.is_a?(Array)) b.to_a.include?(a) elsif (b.is_a?(Hash)) b.include?(a.to_sym) else raise UnsupportedTypeTestException.new(:in, b) end end
test_lt(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 45 def test_lt(a, b) a < b end
test_lte(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 49 def test_lte(a, b) a <= b end
test_regexp(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 85 def test_regexp(a, b) b = Regexp.new(b.to_s) if b.is_a?(String) || b.is_a?(Symbol) raise UnsupportedTypeTestException.new(:regexp, b) unless b.is_a?(Regexp) raise UnsupportedTypeTestException.new(:regexp, a) unless a.is_a?(String) !a.match(b).nil? end
test_size(a, b)
click to toggle source
# File lib/screenplay/actors/test.rb, line 77 def test_size(a, b) if (a.respond_to?(:size)) a.size == b else raise UnsupportedTypeTestException.new(:size, a) end end