Sha256: 2b11e38091c0395e9d6acd7f8eb67ea110c6a58c86b792a26afb28de1e0e86ea

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 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
    expect(client.users!("Gazler").name).to eql("Gary Rennie")
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapidash-0.4.0 spec/rapidash/integration/test_client_spec.rb