Sha256: b71bbdea9581283a24319daf33f1476e9b72d8fa8527458bb8914f703ef7c608
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require File.expand_path("../spec_helper", __FILE__) describe "Keen IO API" do let(:project_id) { ENV['KEEN_PROJECT_ID'] } let(:collection) { "users" } let(:event_properties) { { "name" => "Bob" } } let(:api_success) { { "created" => true } } describe "success" do it "should return a created status for a valid post" do Keen.publish(collection, event_properties).should == api_success end end describe "failure" do it "should raise a not found error if an invalid project id" do client = Keen::Client.new(:project_id => "riker") expect { client.publish(collection, event_properties) }.to raise_error(Keen::NotFoundError) end it "should success if a non-url-safe event collection is specified" do Keen.publish("infinite possibilities", event_properties).should == api_success end end describe "async" do # no TLS support in EventMachine on jRuby unless defined?(JRUBY_VERSION) it "should publish the event and trigger callbacks" do EM.run { Keen.publish_async(collection, event_properties).callback { |response| response.should == api_success EM.stop } } end it "should publish to non-url-safe collections" do EM.run { Keen.publish_async("foo bar", event_properties).callback { |response| response.should == api_success EM.stop } } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
keen-0.5.0 | spec/integration/api_spec.rb |