Skip to content

Commit 4da0f6c

Browse files
committed
Tests
1 parent 07b7c42 commit 4da0f6c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

spec/client_spec.rb

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,49 @@
680680

681681
@client.notify(["test"], payload.merge!(to: "blah", registration_ids: ["reg1", "reg2"]))
682682
end
683+
684+
it "should raise an error for an invalid webhook url field" do
685+
payload = {
686+
gcm: {
687+
notification: {
688+
title: "Hello",
689+
icon: "icon"
690+
}
691+
},
692+
webhook_url: "totallyinvalid"
693+
}
694+
695+
expect { @client.notify(["test"], payload) }.to raise_error(Pusher::Error)
696+
end
697+
698+
it "should raise an error if the webhook level is not supported" do
699+
payload = {
700+
gcm: {
701+
notification: {
702+
title: "Hello",
703+
icon: "icon"
704+
}
705+
},
706+
webhook_url: "totallyinvalid",
707+
webhook_level: "meh"
708+
}
709+
710+
expect { @client.notify(["test"], payload) }.to raise_error(Pusher::Error)
711+
end
712+
713+
it "should raise an error if the webhook level is used without the webhook url" do
714+
payload = {
715+
gcm: {
716+
notification: {
717+
title: "Hello",
718+
icon: "icon"
719+
}
720+
},
721+
webhook_level: "meh"
722+
}
723+
724+
expect { @client.notify(["test"], payload) }.to raise_error(Pusher::Error)
725+
end
683726
end
684727
end
685728

0 commit comments

Comments
 (0)