Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

training white space

  • Loading branch information...
commit 040f3990cb7204d3f17d0ced5b4aa9d208ddb3e3 1 parent 7c72d3a
@niku authored
Showing with 18 additions and 18 deletions.
  1. +18 −18 spec/apn_on_rails/app/models/apn/notification_spec.rb
View
36 spec/apn_on_rails/app/models/apn/notification_spec.rb
@@ -1,19 +1,19 @@
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper.rb')
describe APN::Notification do
-
+
describe 'alert' do
-
+
it 'should trim the message to 150 characters' do
noty = APN::Notification.new
noty.alert = 'a' * 200
noty.alert.should == ('a' * 147) + '...'
end
-
+
end
-
+
describe 'apple_hash' do
-
+
it 'should return a hash of the appropriate params for Apple' do
noty = APN::Notification.first
noty.apple_hash.should == {"aps" => {"badge" => 5, "sound" => "my_sound.aiff", "alert" => "Hello!"},"typ" => "1"}
@@ -28,27 +28,27 @@
noty.sound = true
noty.apple_hash.should == {"aps" => {"sound" => "1.aiff"}}
end
-
+
end
-
+
describe 'to_apple_json' do
-
+
it 'should return the necessary JSON for Apple' do
noty = APN::Notification.first
noty.to_apple_json.should == %{{"typ":"1","aps":{"badge":5,"sound":"my_sound.aiff","alert":"Hello!"}}}
end
-
+
end
-
+
describe 'message_for_sending' do
-
+
it 'should create a binary message to be sent to Apple' do
noty = APN::Notification.first
noty.custom_properties = nil
noty.device = DeviceFactory.new(:token => '5gxadhy6 6zmtxfl6 5zpbcxmw ez3w7ksf qscpr55t trknkzap 7yyt45sc g6jrw7qz')
noty.message_for_sending.should == fixture_value('message_for_sending.bin')
end
-
+
it 'should raise an APN::Errors::ExceededMessageSizeError if the message is too big' do
noty = NotificationFactory.new(:device_id => DeviceFactory.create, :sound => true, :badge => nil)
noty.send(:write_attribute, 'alert', 'a' * 183)
@@ -56,16 +56,16 @@
noty.message_for_sending
}.should raise_error(APN::Errors::ExceededMessageSizeError)
end
-
+
end
-
- describe 'send_notifications' do
-
+
+ describe 'send_notifications' do
+
it 'should warn the user the method is deprecated and call the corresponding method on APN::App' do
ActiveSupport::Deprecation.should_receive(:warn)
APN::App.should_receive(:send_notifications)
APN::Notification.send_notifications
end
end
-
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.