Skip to content

Commit

Permalink
training white space
Browse files Browse the repository at this point in the history
  • Loading branch information
niku committed Apr 16, 2012
1 parent fcbe872 commit 0d5a1c2
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions spec/apn_on_rails/app/models/apn/group_notification_spec.rb
@@ -1,19 +1,19 @@
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper.rb') require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper.rb')


describe APN::GroupNotification do describe APN::GroupNotification do

describe 'alert' do describe 'alert' do

it 'should trim the message to 150 characters' do it 'should trim the message to 150 characters' do
noty = APN::GroupNotification.new noty = APN::GroupNotification.new
noty.alert = 'a' * 200 noty.alert = 'a' * 200
noty.alert.should == ('a' * 147) + '...' noty.alert.should == ('a' * 147) + '...'
end end

end end

describe 'apple_hash' do describe 'apple_hash' do

it 'should return a hash of the appropriate params for Apple' do it 'should return a hash of the appropriate params for Apple' do
noty = APN::GroupNotification.first noty = APN::GroupNotification.first
noty.apple_hash.should == {"aps" => {"badge" => 5, "sound" => "my_sound.aiff", "alert" => "Hello!"},"typ" => "1"} noty.apple_hash.should == {"aps" => {"badge" => 5, "sound" => "my_sound.aiff", "alert" => "Hello!"},"typ" => "1"}
Expand All @@ -28,27 +28,27 @@
noty.sound = true noty.sound = true
noty.apple_hash.should == {"aps" => {"sound" => "1.aiff"}} noty.apple_hash.should == {"aps" => {"sound" => "1.aiff"}}
end end

end end

describe 'to_apple_json' do describe 'to_apple_json' do

it 'should return the necessary JSON for Apple' do it 'should return the necessary JSON for Apple' do
noty = APN::GroupNotification.first noty = APN::GroupNotification.first
noty.to_apple_json.should == %{{"typ":"1","aps":{"badge":5,"sound":"my_sound.aiff","alert":"Hello!"}}} noty.to_apple_json.should == %{{"typ":"1","aps":{"badge":5,"sound":"my_sound.aiff","alert":"Hello!"}}}
end end

end end

describe 'message_for_sending' do describe 'message_for_sending' do

it 'should create a binary message to be sent to Apple' do it 'should create a binary message to be sent to Apple' do
noty = APN::GroupNotification.first noty = APN::GroupNotification.first
noty.custom_properties = nil noty.custom_properties = nil
device = DeviceFactory.new(:token => '5gxadhy6 6zmtxfl6 5zpbcxmw ez3w7ksf qscpr55t trknkzap 7yyt45sc g6jrw7qz') device = DeviceFactory.new(:token => '5gxadhy6 6zmtxfl6 5zpbcxmw ez3w7ksf qscpr55t trknkzap 7yyt45sc g6jrw7qz')
noty.message_for_sending(device).should == fixture_value('message_for_sending.bin') noty.message_for_sending(device).should == fixture_value('message_for_sending.bin')
end end

it 'should raise an APN::Errors::ExceededMessageSizeError if the message is too big' do it 'should raise an APN::Errors::ExceededMessageSizeError if the message is too big' do
app = AppFactory.create app = AppFactory.create
device = DeviceFactory.create({:app_id => app.id}) device = DeviceFactory.create({:app_id => app.id})
Expand All @@ -60,7 +60,7 @@
noty.message_for_sending(device) noty.message_for_sending(device)
}.should raise_error(APN::Errors::ExceededMessageSizeError) }.should raise_error(APN::Errors::ExceededMessageSizeError)
end end

end end

end end

0 comments on commit 0d5a1c2

Please sign in to comment.