Sha256: 1304ba2d928f684b8cc420c99bcd72ea89b0496d6a161c8b458b2f4943cad2ae

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe PostingClient do
  before(:all) do
  end

  before(:each) do
    @posting_client = PostingClient.new
  end

  it "should return Posting object" do
    stub_get_and_json_decode
    @posting_client.get_posting("").is_a?(Posting).should be_true
  end

  # no spec for creation - see tests

  it "should return UpdateResponse object" do
    stub_post_and_json_decode
    UpdateResponse.should_receive(:from_hash).with([])
    post = mock "Posting" , :to_json_for_update=>""
    @posting_client.update_posting(post).class == UpdateResponse.class#).should be_true
  end

  it "should return DeleteResponse object" do
    stub_post_and_json_decode
    DeleteResponse.should_receive(:from_hash).with([])
    @posting_client.delete_posting("").class == DeleteResponse.class
  end

  it "should return boolean value" do
    stub_post_and_json_decode
    ExistsResponse.stub!(:new).and_return mock("ExistsResponse", :exists => true)
    ExistsResponse.should_receive(:new).with(nil)
    @posting_client.exists_posting(mock("Posting", :to_json_for_status=>"")).exists.should be_true
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
threetaps-client-1.0.14 spec/client/posting_client_spec.rb
threetaps-client-1.0.13 spec/client/posting_client_spec.rb
threetaps-client-1.0.12 spec/client/posting_client_spec.rb
threetaps-client-1.0.11 spec/client/posting_client_spec.rb
threetaps-client-1.0.10 spec/client/posting_client_spec.rb
threetaps-client-1.0.9 spec/client/posting_client_spec.rb
threetaps-client-1.0.8 spec/client/posting_client_spec.rb
threetaps-client-1.0.7 spec/client/posting_client_spec.rb
threetaps-client-1.0.6 spec/client/posting_client_spec.rb
threetaps-client-1.0.5 spec/client/posting_client_spec.rb
threetaps-client-1.0.4 spec/client/posting_client_spec.rb
threetaps-client-1.0.3 spec/client/posting_client_spec.rb