Permalink
Browse files

More tests for Provider class.

  • Loading branch information...
1 parent 1eb6efb commit 9f47f992b60fb69fb68dacd99670c0d06e79637a @jtadeulopes committed Nov 15, 2010
Showing with 33 additions and 4 deletions.
  1. +33 −4 spec/provider_spec.rb
View
37 spec/provider_spec.rb
@@ -4,6 +4,7 @@
before :each do
@config = YAML.load_file(File.join(File.dirname(__FILE__), 'settings.yml'))
+ @box = BoxcarAPI::Provider.new(@config['provider_key'], @config['provider_secret'])
end
describe "#subscribe" do
@@ -19,15 +20,43 @@
describe "#broadcast" do
it "should broadcasting notifications to all services" do
- box = BoxcarAPI::Provider.new(@config['provider_key'], @config['provider_secret'])
- box.broadcast("This is an example message.", "from").code.should == 200
+ @box.broadcast("This is an example message.", "from").code.should == 200
+ end
+ it "should accept from_screen_name" do
+ @box.broadcast("message with screen name", "jtadeulopes").code.should == 200
+ end
+ it "should accept from_remote_service_id" do
+ @box.broadcast("message with service id", "jtadeulopes", "unique").code.should == 200
+ end
+ it "should accept redirect_payload" do
+ @box.broadcast("message with redirect payload", "jtadeulopes", nil, "jdg").code.should == 200
+ end
+ it "should accept source_url" do
+ @box.broadcast("message with url", "jtadeulopes", nil, "jdg", "http://google.com").code.should == 200
+ end
+ it "shuold accept icon_url" do
+ @box.broadcast("message with icon", "jtadeulopes", nil, "jdg", "http://google.com", "http://graph.facebook.com/jtadeulopes/picture").code.should == 200
end
end
describe "#notify" do
it "should creating individual notifications" do
- box = BoxcarAPI::Provider.new(@config['provider_key'], @config['provider_secret'])
- box.notify(@config['email'], "This is an example message.", "from").code.should == 200
+ @box.notify(@config['email'], "This is an example message.", "from").code.should == 200
+ end
+ it "should accept from_screen_name" do
+ @box.notify(@config['email'], "message with screen name", "jtadeulopes").code.should == 200
+ end
+ it "should accept from_remote_service_id" do
+ @box.notify(@config['email'], "bla bla", "jtadeulopes", "12345").code.should == 200
+ end
+ it "should accept redirect_payload" do
+ @box.notify(@config['email'], "message with redirect payload", "jtadeulopes", nil, "jdg").code.should == 200
+ end
+ it "should accept source_url" do
+ @box.notify(@config['email'], "message with url", "jtadeulopes", nil, "jdg", "http://google.com").code.should == 200
+ end
+ it "shuold accept icon_url" do
+ @box.notify(@config['email'], "message with icon", "jtadeulopes", nil, "jdg", "http://google.com", "http://graph.facebook.com/jtadeulopes/picture").code.should == 200
end
end

0 comments on commit 9f47f99

Please sign in to comment.