Sha256: 72fe08386742c0a299c2d82a04b42e1b624e585bca0fcb7723b7a11dfae6c236
Contents?: true
Size: 938 Bytes
Versions: 3
Compression:
Stored size: 938 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 gazler = OpenStruct.new({ :headers => { "content-type" => "application/json" }, :body => { :name => "Gary Rennie" }.to_json }) repos = OpenStruct.new({ :headers => { "content-type" => "application/json" }, :body => [ { :name => "Githug" } ].to_json }) responses = { :get => { "members/Gazler" => gazler, "members/Gazler/repos" => repos, } } describe "An actual Rapidash Client" do let!(:client) { Integration::Client.new(:responses => responses) } 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rapidash-0.2.2 | spec/rapidash/integration/test_client_spec.rb |
rapidash-0.2.1 | spec/rapidash/integration/test_client_spec.rb |
rapidash-0.2.0 | spec/rapidash/integration/test_client_spec.rb |