Sha256: a509b862f9005f3dc2341806efe080c2a7034cfa12cbaf70128efaa52507c235

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

require 'spec_helper'

describe Masheri::RpcClient do
  let(:query) {
    "SELECT * FROM whatevers"
  }

  let(:params) {
    {
      'method' => "object.query",
      'params' => [query],
      'id'     => 1
    }
  }

  let(:headers) {
    {
      "Content-Type"   => "application/json",
      "Accept"         => "text/plain",
      "Content-Length" => params.size
    }
  }

  it "should post to RpcClient with the proper arguments" do
    ::RestClient.should_receive(:post).with(Masheri.rpc.url, params.to_json, headers).and_return({hello: 'world'}.to_json)
    Masheri.rpc.query(query)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
masheri-0.6.1 spec/masheri/rpc_client_spec.rb
masheri-0.6.0 spec/masheri/rpc_client_spec.rb