Sha256: 85892989876c1b7db93ca850d39d78235ed8bf65fd9664b56ef52588c32e4633
Contents?: true
Size: 846 Bytes
Versions: 2
Compression:
Stored size: 846 Bytes
Contents
require "spec_helper" require "espago/api_connection" require "json" class StubbedResponse < Struct.new(:body, :status); end class Espago::ApiConnection::StubbedPath def initialize(connection); end def request(params = {}) StubbedResponse.new("{\"data\":\"returned api data\"}", 200) end end class Espago::ApiConnection::UnauthorizedPath def initialize(connection) end def request(params = {}) StubbedResponse.new(nil, 401) end end describe Espago::ApiConnection do subject { Espago::ApiConnection.new("http://some.api.example.com") } context "#create" do it "returns response" do subject.create(:path, :stubbed).should be_a_kind_of Espago::Response end it "raises auth error" do expect { subject.create(:path, :unauthorized) }.to raise_error Espago::AuthenticationError end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
espago-0.0.9 | spec/espago/api_connection_spec.rb |
espago-0.0.7 | spec/espago/api_connection_spec.rb |