Sha256: 5205f439a0ea9b22fbe4dc85796960d1774a30fc692842c66f1e13bdc129ce8b

Contents?: true

Size: 727 Bytes

Versions: 4

Compression:

Stored size: 727 Bytes

Contents

require 'spec_helper'

module Integration
  class Repo < Rapidash::Base
  end

  class User < Rapidash::Base
    url "members"
    resource :repos
  end

  class Client < Rapidash::Client
    method :test
    resource :users
  end
end

responses = {
  :get => {
    "members/Gazler" => { :name => "Gary Rennie" }.to_json,
    "members/Gazler/repos" => [{ :name => "Githug" }].to_json,
  }
}

describe "An actual Rapidash Client" do
  let(:client) { Integration::Client.new(responses, :json => true) }

  it "should get the user from the API" do
    client.users!("Gazler").name.should eql("Gary Rennie")
  end

  it "should get the repos from A user" do
    client.users("Gazler").repos![0].name.should eql("Githug")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rapidash-0.3.1 spec/rapidash/integration/test_client_spec.rb
rapidash-0.3.0 spec/rapidash/integration/test_client_spec.rb
rapidash-0.3.0.beta2 spec/rapidash/integration/test_client_spec.rb
rapidash-0.3.0.beta spec/rapidash/integration/test_client_spec.rb