Module Rucola::TestCase
In: lib/rucola/test_case.rb

Methods

tests  

Included Modules

Rucola::TestCase::InstanceMethods

Classes and Modules

Module Rucola::TestCase::InstanceMethods

Public Instance methods

Defines the controller that will be tested.

  class ApplicationController < OSX::NSObject
    ib_outlet :window
    ib_outlets :tableView, :searchField
    ib_outlets :textField
  end

  class TestFoo < Test::Unit::TestCase
    tests ApplicationController

    def after_setup
      ib_outlets :window => mock("Main Window"),
                 :tableView => OSX::NSTableView.alloc.init,
                 :searchField => OSX::NSSearchField.alloc.init

      window.stubs(:title => 'Main Window')
      tableView.addTableColumn OSX::NSTableColumn.alloc.init
      searchField.stringValue = "foo"
    end

    def test_something
      p controller # => #<ApplicationController:0xdfa1ce class='ApplicationController' id=0x1e8d0e0>
      p window.title # => "Main Window"
      p tableView.tableColumns # => #<NSCFArray [#<OSX::NSTableColumn:0xdf9d0a class='NSTableColumn' id=0x1e90d00>]>
      p searchField # => #<OSX::NSSearchField:0xdfa43a class='NSSearchField' id=0x1e84cb0>

      # Note that we haven't set the textField ib_outlet to anything else in the after_setup method,
      # so it will be a stub which responds to everything by returning nil.
      p textField # => #<Mock:textField>
    end
  end

[Validate]