Sha256: a6e8e7796d5ee1334e28f79a00d8500e7e168df3dc8b76a1870c4eb6f095c071

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

require 'spec/spec_helper'
require 'examples/rails'

describe ROXML, "under ActiveRecord" do
  before do
    @route = Route.from_xml(xml_for('active_record'))
  end

  before(:all) do
    FileUtils.rm(DB_PATH) if File.exists?(DB_PATH)
  end

  it "should be parsed" do
    @route.should_not == nil
    @route.should be_an_instance_of(Route)
  end

  describe "xml attributes" do
    it "should extract xml attributes" do
      @route.totalHg.should == "640"
      @route.lonlatx.should == "357865"
      @route.lonlaty.should == "271635"
      @route.grcenter.should == "SH 71635 57865"
      @route.totalMins.should == "235.75000000000003"
      @route.totalDist.should == "11185.321521477119"
    end
  end

  describe "xml sub-objects" do
    it "should extract xml sub-objects" do
      @route.should have(6).waypoints
      @route.waypoints.each {|waypoint| waypoint.should be_an_instance_of(Waypoint)}
    end
    it "should be usable as a ActiveRecord object" do
      Waypoint.count.should == 0
      @route.save!
      Waypoint.count.should == 6
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
yob-roxml-3.1.6 spec/examples/active_record_spec.rb
roxml-3.1.5 spec/examples/active_record_spec.rb
roxml-3.1.4 spec/examples/active_record_spec.rb
roxml-3.1.3 spec/examples/active_record_spec.rb
roxml-3.1.2 spec/examples/active_record_spec.rb
roxml-3.1.1 spec/examples/active_record_spec.rb
roxml-3.1.0 spec/examples/active_record_spec.rb
ROXML-3.0.0 spec/examples/active_record_spec.rb