Sha256: a86bf89b8ea40791096a4afe1026b6cd2cf4b74f45b99f6ee1714dd7b1079725
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require File.expand_path("../spec_helper", __FILE__) describe Keen::Client do let(:project_id) { "12345" } let(:api_key) { "abcde" } let(:client) { Keen::Client.new(:project_id => project_id) } describe "#initialize" do context "deprecated" do it "should allow created via project_id and api_key args" do client = Keen::Client.new(project_id, api_key) client.api_key.should == api_key client.project_id.should == project_id end end it "should initialize with options" do client = Keen::Client.new( :project_id => project_id, :api_key => api_key) client.api_key.should == api_key client.project_id.should == project_id end end describe "process_response" do let (:body) { "{ \"wazzup\": 1 }" } let (:process_response) { client.method(:process_response) } it "should raise a bad request error for a 400" do process_response.call(200, body).should == { "wazzup" => 1 } end it "should raise a bad request error for a 400" do expect { process_response.call(400, body) }.to raise_error(Keen::BadRequestError) end it "should raise a authentication error for a 401" do expect { process_response.call(401, body) }.to raise_error(Keen::AuthenticationError) end it "should raise a not found error for a 404" do expect { process_response.call(404, body) }.to raise_error(Keen::NotFoundError) end it "should raise an http error otherwise" do expect { process_response.call(420, body) }.to raise_error(Keen::HttpError) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
keen-0.6.0 | spec/keen/client_spec.rb |