Sha256: 7c2bf9cbddafeb6290a44ed0af99a71132b830e011b337ee77c6dad95ca2ec68

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe Rosemary::Way do

  before do
    WebMock.disable_net_connect!
  end

  let :osm do
    Rosemary::Api.new
  end

  def valid_fake_way
    way=<<-EOF
    <osm>
     <way id="1234" version="142" changeset="12" user="fred" uid="123" visible="true" timestamp="2005-07-30T14:27:12+01:00">
       <tag k="note" v="Just a way"/>
       <nd ref="15735248"/>
       <nd ref="169269997"/>
       <nd ref="169270001"/>
       <nd ref="15735251"/>
       <nd ref="15735252"/>
       <nd ref="15735253"/>
       <nd ref="15735250"/>
       <nd ref="15735247"/>
       <nd ref="15735246"/>
       <nd ref="15735249"/>
       <nd ref="15735248"/>
     </way>
    </osm>
    EOF
  end

  describe '#find:' do

    it "should build a Way from API response via get_way" do
      stub_request(:get, "http://www.openstreetmap.org/api/0.6/way/1234").to_return(:status => 200, :body => valid_fake_way, :headers => {'Content-Type' => 'application/xml'})
      way = osm.find_way(1234)
      way.class.should eql Rosemary::Way
      way.nodes.should include(15735246)
    end
  end

  describe '#create:' do
  end

  describe '#update:' do
  end

  describe '#delete:' do
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rosemary-0.2.8 spec/integration/way_spec.rb
rosemary-0.2.7 spec/integration/way_spec.rb
rosemary-0.2.6 spec/integration/way_spec.rb
rosemary-0.2.5 spec/integration/way_spec.rb
rosemary-0.2.4 spec/integration/way_spec.rb
rosemary-0.2.3 spec/integration/way_spec.rb
rosemary-0.2.2 spec/integration/way_spec.rb