Sha256: 657c67814ef6ec15da9319d1cae87e3ede00cda5c84ea359b9ad3dc935f51ba4

Contents?: true

Size: 1.78 KB

Versions: 4

Compression:

Stored size: 1.78 KB

Contents

describe "map properties" do

  before do
    # Simulate AppDelegate setup of map screen
    @map = TestMapScreen.new modal: true, nav_bar: true
    @map.view_will_appear(false)
  end

  it "should store title" do
    @map.get_title.should == "Gorges State Park, NC"
  end

  it "should have 5 annotations" do
    @map.annotations.count.should == 5
  end

  it "should convert annotation hashes to MapViewAnnotations" do
    @map.annotations.each do |annotation|
      annotation.class.to_s.should == "NSKVONotifying_MapScreenAnnotation"
    end
  end

  it "should add an annotation" do
    ann = {
      longitude: -82.966093558105,
      latitude: 35.092520895652,
      title: "Something Else"
    }
    @map.add_annotation(ann)
    @map.annotations.count.should == 6
  end

  it "should return custom annotation parameters" do
    ann = {
      longitude: -82.966093558105,
      latitude: 35.092520895652,
      title: "Custom",
      another_value: "Mark"
    }
    @map.add_annotation(ann)
    @map.annotations.last.another_value.should == "Mark"
  end

  it "should return nil for custom annotation parameters that don't exist" do
    ann = {
      longitude: -82.966093558105,
      latitude: 35.092520895652,
      title: "Custom",
      another_value: "Mark"
    }
    @map.add_annotation(ann)
    @map.annotations.last.another_value_fake.should == nil
  end

  it "should clear annotations" do
    @map.clear_annotations
    @map.annotations.count.should == 0
  end

  it "should geocode an address" do
    @map.lookup_infinite_loop
    wait_for_change @map, 'infinite_loop_points' do
      placemarks = @map.infinite_loop_points
      placemarks.count.should == 1
      placemarks.first.postalCode.should == "95014"
      placemarks.first.description.include?("Cupertino").should == true
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ProMotion-1.1.2 spec/unit/map_spec.rb
ProMotion-1.1.1 spec/unit/map_spec.rb
ProMotion-1.1.0 spec/unit/map_spec.rb
ProMotion-1.1.0.rc1 spec/unit/map_spec.rb