require 'spec_helper' describe Masheri::Member do let(:url) { Masheri.rpc.url } let(:items) { [{"name" => "Name"}] * 10 } let(:params) { { 'method' => "object.query", 'params' => [query], 'id' => 1 } } let(:headers) { { "Content-Type" => "application/json", "Accept" => "text/plain", "Content-Length" => params.size } } let(:json) { { "result" => { "items" => items } }.to_json } context "with standard query" do let(:query) { "SELECT * FROM members ITEMS 100" } it "should grab all the members" do ::RestClient.should_receive(:post).with(url, params.to_json, headers).and_return(json) objects = Masheri::Member.all objects.length.should == 10 end end end