Sha256: e4e8ac6b4f4d4dfbd17b636324677e88fc0ef56c461d4b8ce31e02234f313d11

Contents?: true

Size: 825 Bytes

Versions: 8

Compression:

Stored size: 825 Bytes

Contents

require 'spec_helper'

describe Mashery::Member do
  let(:url) { Mashery.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 = Mashery::Member.all
      objects.length.should == 10
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

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