Sha256: 820b7f1f6f06c835b296b0ffacf27f6489fd7392b6e70f37bfa999963ad0888b

Contents?: true

Size: 602 Bytes

Versions: 8

Compression:

Stored size: 602 Bytes

Contents

require 'spec_helper'

describe Mashery::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(Mashery.rpc.url, params.to_json, headers).and_return({hello: 'world'}.to_json)
    Mashery.rpc.query(query)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mashery_rails-0.6.9.pre4 spec/mashery/rpc_client_spec.rb
mashery_rails-0.6.9.pre3 spec/mashery/rpc_client_spec.rb
mashery_rails-0.6.9.pre1 spec/mashery/rpc_client_spec.rb
mashery_rails-0.6.8 spec/mashery/rpc_client_spec.rb
mashery_rails-0.6.7 spec/mashery/rpc_client_spec.rb
mashery_rails-0.6.6 spec/mashery/rpc_client_spec.rb
mashery_rails-0.6.3 spec/mashery/rpc_client_spec.rb
mashery_rails-0.6.2 spec/mashery/rpc_client_spec.rb