I implemented @colinta 's idea which was discussed below link.
https://groups.google.com/d/msg/rubymotion/M9T6LybaEUs/AWip_Vwy5_4J
When you want to setup UIViewController, you can setup it in a block of tests method.
# Example
describe MyViewController do
tests MyViewController do |controller|
# you can set data to the controller here
controller.my_data = "foo"
end
.
.
end
Sometimes view controller has a data.
The controller was set as a root view controller to the window before called "before" block.
But a data is not set at this point.
The view controller access to nil, and crash sometime even if I set a data in "before" block.
After created controller it will call the specified callback method if you set :after_created option
# Example
describe MyViewController do
tests MyViewController, after_created: :after_created_controller
def after_created_controller controller
# you can set data to the controller here
controller.my_data = "foo"
end
.
.
end