Sha256: faa925ecd947ee9e54a4e8d7d38ce022ea9d2c0e4f39e39c5226d57c2653cfe0

Contents?: true

Size: 994 Bytes

Versions: 9

Compression:

Stored size: 994 Bytes

Contents

require "spec_helper"

describe "User" do
  context "basic request executing" do
    before do
      stub_request(:get, /#{TheBigDB.api_host}\/v#{TheBigDB.api_version}\/users\/show/).to_return(:body => '{"server_says": "hello world"}')

      @request = TheBigDB::User(:show, login: "christophe")
    end

    it "sets the correct data_sent instance variable" do
      @request.data_sent.should == {
          "headers" => Hash[@request.http_request.to_hash.map{|k,v| [k, v.join] }],
          "host" => TheBigDB.api_host,
          "port" => TheBigDB.api_port,
          "path" => "/v#{TheBigDB.api_version}/users/show",
          "method" => "GET",
          "params" => {"login" => "christophe"}
        }
    end

    it "sets the correct data_received instance variable" do
      @request.data_received.should include({
          "headers" => Hash[@request.http_response.to_hash.map{|k,v| [k, v.join] }],
          "content" => {"server_says" => "hello world"}
        })
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
thebigdb-1.4.1 spec/resources/user_spec.rb
thebigdb-1.4.0 spec/resources/user_spec.rb
thebigdb-1.3.0 spec/resources/user_spec.rb
thebigdb-1.2.3 spec/resources/user_spec.rb
thebigdb-1.2.2 spec/resources/user_spec.rb
thebigdb-1.2.1 spec/resources/user_spec.rb
thebigdb-1.2.0 spec/resources/user_spec.rb
thebigdb-1.1.0 spec/resources/user_spec.rb
thebigdb-1.0.0 spec/resources/user_spec.rb