Sha256: 3792db733647e48abe5dd57c8449f921971713cfecf4e654f0a4395dbe9059ad

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

describe "PM::Delegate" do

  before { @subject = TestDelegate.new }

  it 'should call on_load on launch' do
    @subject.mock!(:on_load) do |app, options|
      options[:jamon].should.be.true
      app.should.be.kind_of(UIApplication)
    end

    @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions:{jamon: true})
  end

  it "should handle push notifications" do

    @subject.mock!(:on_push_notification) do |notification|
      notification.should.be.kind_of(PM::PushNotification)
      notification.alert.should == "Eating Bacon"
      notification.badge.should == 42
      notification.sound.should == "jamon"
      @subject.aps_notification.should == notification
    end

    launch_options = { UIApplicationLaunchOptionsRemoteNotificationKey => PM::PushNotification.fake_notification(alert: "Eating Bacon", badge: 42, sound: "jamon").notification }
    @subject.application(nil, didFinishLaunchingWithOptions:launch_options )

  end

  it "should set home_screen when opening a new screen" do

    @subject.application(UIApplication.sharedApplication, didFinishLaunchingWithOptions: nil)
    @subject.open BasicScreen.new(nav_bar: true)
    @subject.home_screen.should.be.kind_of BasicScreen
    @subject.window.rootViewController.should.be.kind_of UINavigationController

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ProMotion-0.7.8 spec/unit/delegate_spec.rb
ProMotion-0.7.6 spec/unit/delegate_spec.rb
ProMotion-0.7.5 spec/unit/delegate_spec.rb