Module: MiniTest::Assertions
- Defined in:
- lib/minitest/macruby.rb
Instance Method Summary collapse
- #assert_ui_action(obj, target, action, key = nil) ⇒ Object
- #assert_ui_binding(item, binding_name, target, path) ⇒ Object
- #assert_ui_menu(menu, *items) ⇒ Object
- #find_ui_menu(*path) ⇒ Object
- #find_ui_menu_item(*path) ⇒ Object
- #find_ui_menu_items(menu) ⇒ Object
Instance Method Details
#assert_ui_action(obj, target, action, key = nil) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/minitest/macruby.rb', line 41 def assert_ui_action obj, target, action, key = nil refute_nil obj, action assert_equal target, obj.target assert_equal action.to_sym, obj.action assert_equal key, obj.keyEquivalent if key end |
#assert_ui_binding(item, binding_name, target, path) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/minitest/macruby.rb', line 48 def assert_ui_binding item, binding_name, target, path refute_nil item refute_nil target binding = item.infoForBinding binding_name.to_s refute_nil binding assert_equal path, binding["NSObservedKeyPath"] assert_equal target, binding["NSObservedObject"] end |
#assert_ui_menu(menu, *items) ⇒ Object
30 31 32 33 34 |
# File 'lib/minitest/macruby.rb', line 30 def , *items item_titles = ().map { |item| item.title } assert_equal items, item_titles end |
#find_ui_menu(*path) ⇒ Object
19 20 21 22 |
# File 'lib/minitest/macruby.rb', line 19 def (*path) app = NSApplication.sharedApplication = path.inject(app.mainMenu) { |m, n| m.itemWithTitle(n). } end |
#find_ui_menu_item(*path) ⇒ Object
36 37 38 39 |
# File 'lib/minitest/macruby.rb', line 36 def (*path) item_name = path.pop (path).itemWithTitle item_name end |
#find_ui_menu_items(menu) ⇒ Object
24 25 26 27 28 |
# File 'lib/minitest/macruby.rb', line 24 def = .itemArray end |