Sha256: e74bb4b2ce77ffbbb48f01b828cb84080a628fdb46eb8e04c3c6e4219ad5d6d1
Contents?: true
Size: 951 Bytes
Versions: 1
Compression:
Stored size: 951 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'json' include OldApiResource describe Mocks do # we set up the mocks in spec helper, so we can just assert this it "should hijack the connection" do OldApiResource::Mocks::Interface.any_instance.expects(:get).once.returns( OldApiResource::Mocks::MockResponse.new("", {:headers => {"Content-type" => "application/json"}, :status_code => 200}) ) TestResource.reload_class_attributes end it "should allow the user to raise errors for invalid responsed" do old_err_status = OldApiResource.raise_missing_definition_error OldApiResource::Base.raise_missing_definition_error = true lambda { class MyNewInvalidResource < OldApiResource::Base; end MyNewInvalidResource.new }.should raise_error(OldApiResource::ResourceNotFound) OldApiResource.raise_missing_definition_error = old_err_status end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
old_api_resource-0.3.0 | spec/lib/mocks_spec.rb |