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


Public Instance methods

Lets you get an instance variable from the instance.

  obj.instance_variable_set(:@some_attr, 'foo')
  assigns(:some_attr) # => 'foo'

You can also set an instance variable in the instance.

  obj.assigns(:some_attr, 'bar')
  obj.instance_variable_get(:@some_attr) # => 'bar'

Returns the class that‘s to be tested.


Defines instance variables in the instance which represent the ib_outlets. It basically just sets the instance variables, but also creates shorcut accessors to get at them from your tests.

  def after_setup
    ib_outlet :textField, OSX::NSTextField.alloc.init
    p textField # => #<OSX::NSTextField:0xdfa3f4 class='NSTextField' id=0x1e842b0>

Note that not every class can be instantiated in a test. So you can also supply something like a mock.

Shortcut method to defined multiple ib_outlets by supplying a hash.

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

An instance of the class that‘s to be tested.

Sets up the ib_outlets to all be stubs which respond to everything with nil.

In your test use after_setup to do any custom setup.

Sets the ib_outlets and instance to be tested to nil at the end of the test.

In your test use after_teardown to do any custom teardown.