Sha256: 5428ee056f8a32122c6b6c867e6f4b3cdcd82f16606959b5b05beefb7192f1bc

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

#= require lotion/application

describe Lotion::Application do

  subject do
    include Lotion::Application
  end
  before do
    @center = subject.notification_center
  end
  it 'includes the correct concerns' do
    subject.should be_a( Lotion::Notifications )
  end
  it 'defines #screen' do
    subject.screen.should == UIScreen.mainScreen
  end
  it 'defines #window' do
    subject.window.should be_a( UIWindow )
  end
  it 'defined #views' do
    subject.views.should be_a( Hash )
  end
  it 'notifies after application startup' do
    options = { :foo => 'bar' }

    @center.mock! 'postNotificationName:object:userInfo:' do |name, from, info|
      name.should == 'application:startup'
      from.should == subject
      info.should == options
    end

    subject.application( nil, didFinishLaunchingWithOptions:options ).should == true
  end
  it 'responds to #on' do
    subject.should.respond_to :on
  end
  it 'attaches commands to notifications' do
    command = stub :call, :return => true

    @center.mock! 'addObserver:selector:name:object:' do |klass, selector, name, object|
      klass.should    == command
      selector.should == 'call:'
      name.should     == 'foo'
      object.should   == nil
    end

    subject.on 'foo', command
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotion-0.1.0 spec/lotion/application_spec.rb