lib/atp/flow_api.rb in atp-1.0.0 vs lib/atp/flow_api.rb in atp-1.1.0
- old
+ new
@@ -7,11 +7,11 @@
def atp
@atp
end
([:test, :bin, :pass, :continue, :cz, :log, :sub_test, :volatile, :set_flag, :enable, :disable, :render,
- :context_changed?] +
+ :context_changed?, :ids, :describe_bin, :describe_softbin, :describe_soft_bin] +
ATP::Flow::CONDITION_KEYS.keys).each do |method|
define_method method do |*args, &block|
options = args.pop if args.last.is_a?(Hash)
options ||= {}
add_meta!(options) if respond_to?(:add_meta!, true)
@@ -20,7 +20,37 @@
atp.send(method, *args, &block)
end
end
alias_method :logprint, :log
+
+ def lo_limit(value, options)
+ {
+ value: value,
+ rule: options[:rule] || :gte,
+ units: options[:units],
+ selector: options[:selector] || options[:test_mode]
+ }
+ end
+
+ def hi_limit(value, options)
+ {
+ value: value,
+ rule: options[:rule] || :lte,
+ units: options[:units],
+ selector: options[:selector] || options[:test_mode]
+ }
+ end
+
+ def limit(value, options)
+ unless options[:rule]
+ fail 'You must supply option :rule (e.g. rule: :gt) when calling the limit helper'
+ end
+ {
+ value: value,
+ rule: options[:rule] || :lt,
+ units: options[:units],
+ selector: options[:selector] || options[:test_mode]
+ }
+ end
end
end