Sha256: f8ccb9a6e890befaafbb23e9465fa83f948b94a7a3651ead81d2975339e1757c

Contents?: true

Size: 581 Bytes

Versions: 38

Compression:

Stored size: 581 Bytes

Contents

module Rubix
  module ResponseSpecs
    def mock_response result={}, code=200
      response = mock("Net::HTTPResponse")
      response.stub!(:body).and_return({"jsonrpc" => "2.0", "result" => result}.to_json)
      response.stub!(:code).and_return(code.to_s)
      Rubix::Response.new(response)
    end

    def mock_error message='', code=200
      response = mock("Net::HTTPResponse")
      response.stub!(:body).and_return({"jsonrpc" => "2.0", "error" => message}.to_json)
      response.stub!(:code).and_return(code.to_s)
      Rubix::Response.new(response)
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
rubix-0.5.14 spec/support/response_helper.rb
rubix-0.5.13 spec/support/response_helper.rb
rubix-0.5.9 spec/support/response_helper.rb
rubix-0.5.8 spec/support/response_helper.rb
rubix-0.5.7 spec/support/response_helper.rb
rubix-0.5.6 spec/support/response_helper.rb
rubix-0.5.5 spec/support/response_helper.rb
rubix-0.5.4 spec/support/response_helper.rb
rubix-0.5.3 spec/support/response_helper.rb
rubix-0.5.2 spec/support/response_helper.rb
rubix-0.5.1 spec/support/response_helper.rb
rubix-0.5.0 spec/support/response_helper.rb
rubix-0.4.3 spec/support/response_helper.rb
rubix-0.4.2 spec/support/response_helper.rb
rubix-0.4.1 spec/support/response_helper.rb
rubix-0.4.0 spec/support/response_helper.rb
rubix-0.3.1 spec/support/response_helper.rb
rubix-0.3.0 spec/support/response_helper.rb
rubix-0.2.1 spec/support/response_helper.rb
rubix-0.2.0 spec/support/response_helper.rb