module MiniTest::Assertions

Public Instance Methods

assert_ui_action(obj, target, action, key = nil) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/minitest/macruby.rb, line 30
def assert_ui_menu menu, *items
  item_titles = find_ui_menu_items(menu).map { |item| item.title }

  assert_equal items, item_titles
end
find_ui_menu(*path) click to toggle source
# File lib/minitest/macruby.rb, line 19
def find_ui_menu(*path)
  app  = NSApplication.sharedApplication
  menu = path.inject(app.mainMenu) { |m, n| m.itemWithTitle(n).submenu }
end
find_ui_menu_item(*path) click to toggle source
# File lib/minitest/macruby.rb, line 36
def find_ui_menu_item(*path)
  item_name = path.pop
  find_ui_menu(path).itemWithTitle item_name
end
find_ui_menu_items(menu) click to toggle source
# File lib/minitest/macruby.rb, line 24
def find_ui_menu_items menu
  menu = find_ui_menu menu

  menu.itemArray
end