Sha256: 550e83d476e104e2e8d52cd3b3a075b0efd01f3dbb45135a2a1d36d20cd966ba

Contents?: true

Size: 1.32 KB

Versions: 18

Compression:

Stored size: 1.32 KB

Contents

require 'rspec'
require_relative '../lib/restful_resource'
require_relative 'fixtures'

RSpec.configure do |config|
  config.color = true
  config.formatter = :progress
end


def expect_get(url, response)
  expect(@mock_http).to receive(:get).with(url).and_return(response)
end

def expect_delete(url, response)
  expect(@mock_http).to receive(:delete).with(url).and_return(response)
end

def expect_put(url, response, data: {})
  expect(@mock_http).to receive(:put).with(url, data: data).and_return(response)
end

def expect_post(url, response, data: {})
  expect(@mock_http).to receive(:post).with(url, data: data).and_return(response)
end

def expect_put_with_unprocessable_entity(url, response, data: {})
  rest_client_response = OpenStruct.new({body: response.body, headers: response.headers, code: response.status})
  exception = RestfulResource::HttpClient::UnprocessableEntity.new(rest_client_response)
  expect(@mock_http).to receive(:put).with(url, data: data).and_raise(exception)
end

def expect_post_with_unprocessable_entity(url, response, data: {})
  rest_client_response = OpenStruct.new({body: response.body, headers: response.headers, code: response.status})
  exception = RestfulResource::HttpClient::UnprocessableEntity.new(rest_client_response)
  expect(@mock_http).to receive(:post).with(url, data: data).and_raise(exception)
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
restful_resource-0.10.2 spec/spec_helper.rb
restful_resource-0.10.1 spec/spec_helper.rb
restful_resource-0.10.0 spec/spec_helper.rb
restful_resource-0.9.7 spec/spec_helper.rb
restful_resource-0.9.5 spec/spec_helper.rb
restful_resource-0.9.4 spec/spec_helper.rb
restful_resource-0.9.3 spec/spec_helper.rb
restful_resource-0.9.2 spec/spec_helper.rb
restful_resource-0.9.1 spec/spec_helper.rb
restful_resource-0.9.0 spec/spec_helper.rb
restful_resource-0.8.34 spec/spec_helper.rb
restful_resource-0.8.33 spec/spec_helper.rb
restful_resource-0.8.32 spec/spec_helper.rb
restful_resource-0.8.30 spec/spec_helper.rb
restful_resource-0.8.29 spec/spec_helper.rb
restful_resource-0.8.28 spec/spec_helper.rb
restful_resource-0.8.27 spec/spec_helper.rb
restful_resource-0.8.26 spec/spec_helper.rb