Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update specs to use "expect" style and test latests Rubies on Travis #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
- jruby-19mode # JRuby in 1.9 mode
# uncomment this line if your project needs to run something other than `rake`:
# script: bundle exec rspec spec
- 2.0
- 2.1
- 2.2
- ruby-head
- rbx-2
- jruby-19mode
- jruby-head
matrix:
# allow failures for head builds
allow_failures:
- rvm: ruby-head
- rvm: jruby-head
fast_finish: true
34 changes: 17 additions & 17 deletions spec/lib/pushmeup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
describe Pushmeup do
describe "APNS" do
it "should have a APNS object" do
defined?(APNS).should_not be_false
expect(defined?(APNS)).to be_truthy
end

it "should not forget the APNS default parameters" do
APNS.host.should == "gateway.sandbox.push.apple.com"
APNS.port.should == 2195
APNS.pem.should be_equal(nil)
APNS.pass.should be_equal(nil)
expect(APNS.host).to eq("gateway.sandbox.push.apple.com")
expect(APNS.port).to eq(2195)
expect(APNS.pem).to be_nil
expect(APNS.pass).to be_nil
end

describe "Notifications" do
Expand All @@ -20,7 +20,7 @@
it "should properly equate objects without caring about object identity" do
a = APNS::Notification.new("123", {:alert => "hi"})
b = APNS::Notification.new("123", {:alert => "hi"})
a.should eq(b)
expect(a).to eq(b)
end

end
Expand All @@ -31,7 +31,7 @@

describe "GCM" do
it "should have a GCM object" do
defined?(GCM).should_not be_false
expect(defined?(GCM)).to be_truthy
end

describe "Notifications" do
Expand All @@ -42,36 +42,36 @@

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
expect(n.device_tokens).to be_an(Array)

n.device_tokens = ["a" "b", "c"]
n.device_tokens.is_a?(Array).should be_true
expect(n.device_tokens).to be_an(Array)

n.device_tokens = "a"
n.device_tokens.is_a?(Array).should be_true
expect(n.device_tokens).to be_an(Array)
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.should == {:data => "data"}
expect(n.data).to be_a(Hash)
expect(n.data).to eq(:data => "data")

n.data = {:a => ["a", "b", "c"]}
n.data.is_a?(Hash).should be_true
n.data.should == {:a => ["a", "b", "c"]}
expect(n.data).to be_a(Hash)
expect(n.data).to eq(:a => ["a", "b", "c"])

n.data = {:a => "a"}
n.data.is_a?(Hash).should be_true
n.data.should == {:a => "a"}
expect(n.data).to be_a(Hash)
expect(n.data).to eq(:a => "a")
end

describe "#==" do

it "should properly equate objects without caring about object identity" do
a = GCM::Notification.new("id", { :data => "data" })
b = GCM::Notification.new("id", { :data => "data" })
a.should eq(b)
expect(a).to eq(b)
end

end
Expand Down