diff --git a/.ruby-version b/.ruby-version index 67b8bc0..75bfecd 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-1.9.3 +1.9.3-p547 diff --git a/spec/lib/pushmeup_spec.rb b/spec/lib/pushmeup_spec.rb index 80264af..5ee51bf 100644 --- a/spec/lib/pushmeup_spec.rb +++ b/spec/lib/pushmeup_spec.rb @@ -3,16 +3,25 @@ describe Pushmeup do describe "APNS" do it "should have a APNS object" do - defined?(APNS).should_not be_false + defined?(APNS).should_not be_nil end - it "should not forget the APNS default parameters" do - APNS.host.should == "gateway.sandbox.push.apple.com" - APNS.port.should == 2195 + it "should have gateway.sandbox.push.apple.com as default host" do + APNS.host.eql?("gateway.sandbox.push.apple.com").should be_truthy + end + + it "should have 2195 as default port" do + APNS.port.eql?(2195).should be_truthy + end + + it "should have nil pem by default" do APNS.pem.should be_equal(nil) - APNS.pass.should be_equal(nil) end + it "should have nil password by default" do + APNS.pass.should be_equal(nil) + end + describe "Notifications" do describe "#==" do @@ -31,7 +40,7 @@ describe "GCM" do it "should have a GCM object" do - defined?(GCM).should_not be_false + defined?(GCM).should_not be_nil end describe "Notifications" do @@ -40,29 +49,41 @@ @options = {:data => "dummy data"} end + it "should have https://android.googleapis.com/gcm/send as host by default" do + GCM.host.eql?("https://android.googleapis.com/gcm/send").should be_truthy + end + + it "should have json as format by default" do + GCM.format.eql?(:json).should be_truthy + end + + it "should have nil key by default" do + GCM.key.should be_equal(nil) + end + it "should allow only notifications with device_tokens as array" do n = GCM::Notification.new("id", @options) - n.device_tokens.is_a?(Array).should be_true + n.device_tokens.is_a?(Array).should be_truthy n.device_tokens = ["a" "b", "c"] - n.device_tokens.is_a?(Array).should be_true + n.device_tokens.is_a?(Array).should be_truthy n.device_tokens = "a" - n.device_tokens.is_a?(Array).should be_true + n.device_tokens.is_a?(Array).should be_truthy end it "should allow only notifications with data as hash with :data root" do n = GCM::Notification.new("id", { :data => "data" }) - n.data.is_a?(Hash).should be_true + n.data.is_a?(Hash).should be_truthy n.data.should == {:data => "data"} n.data = {:a => ["a", "b", "c"]} - n.data.is_a?(Hash).should be_true + n.data.is_a?(Hash).should be_truthy n.data.should == {:a => ["a", "b", "c"]} n.data = {:a => "a"} - n.data.is_a?(Hash).should be_true + n.data.is_a?(Hash).should be_truthy n.data.should == {:a => "a"} end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c78a9ab..4966df8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1 @@ -require 'pushmeup' +require 'pushmeup' \ No newline at end of file