Sha256: c735751bfd5743008bd5935b1cdd5d51d20a71465d75edf3e6f12e57ea0a55da

Contents?: true

Size: 975 Bytes

Versions: 2

Compression:

Stored size: 975 Bytes

Contents

require './spec/spec_helper'


describe SharedListing do
  before(:each) do
    stub_auth_request
  end

  it "should respond to the finders" do
    SharedListing.should respond_to(:find)
  end

  it "should save shared listings" do
    stub_api_post("/#{subject.class.element_name}", 'shared_listing_new.json', 'shared_listing_post.json')
    subject.ListingIds = ["20110224152431857619000000","20110125122333785431000000"]
    subject.ViewId = "20080125122333787615000000"
    subject.save.should be(true)
    subject.ResourceUri.should eq("http://www.flexmls.com/share/15Ar/3544-N-Olsen-Avenue-Tucson-AZ-85719")
  end

  it "should fail saving" do
    stub_api_post("/#{subject.class.element_name}",'empty.json') do |request|
      request.to_return(:status => 400, :body => fixture('errors/failure.json'))
    end
    subject
    subject.save.should be(false)
    expect{ subject.save! }.to raise_error(FlexmlsApi::ClientError){ |e| e.status.should == 400 }
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flexmls_api-0.6.5 spec/unit/flexmls_api/models/shared_listing_spec.rb
flexmls_api-0.6.4 spec/unit/flexmls_api/models/shared_listing_spec.rb