module Motion::TestHelpers
Public Instance Methods
assert_motion(component, motion_name)
click to toggle source
# File lib/motion/test_helpers.rb, line 7 def assert_motion(component, motion_name) assert motion?(component, motion_name) end
motion?(component, motion_name)
click to toggle source
# File lib/motion/test_helpers.rb, line 15 def motion?(component, motion_name) component.motions.include?(motion_name.to_s) end
motion_event(attributes = {})
click to toggle source
# File lib/motion/test_helpers.rb, line 29 def motion_event(attributes = {}) Motion::Event.new(ActiveSupport::JSON.decode(attributes.to_json)) end
refute_motion(component, motion_name)
click to toggle source
# File lib/motion/test_helpers.rb, line 11 def refute_motion(component, motion_name) refute motion?(component, motion_name) end
run_motion(component, motion_name, event = motion_event) { |c| ... }
click to toggle source
# File lib/motion/test_helpers.rb, line 19 def run_motion(component, motion_name, event = motion_event) if block_given? c = component.dup c.process_motion(motion_name.to_s, event) yield c else component.process_motion(motion_name.to_s, event) end end