Sha256: 85844653ae051115a68b1decb6c9e7d1da25cba75963bd89049264644ed77e47

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 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

5 entries across 5 versions & 1 rubygems

Version Path
ProMotion-0.7.4 spec/unit/delegate_spec.rb
ProMotion-0.7.3 spec/unit/delegate_spec.rb
ProMotion-0.7.2 spec/unit/delegate_spec.rb
ProMotion-0.7.1 spec/unit/delegate_spec.rb
ProMotion-0.7.0 spec/unit/delegate_spec.rb