]> git.openstreetmap.org Git - rails.git/blob - test/models/tracepoint_test.rb
ae258f43a09b4d9a2b29c1abb44567ded53286b1
[rails.git] / test / models / tracepoint_test.rb
1 require "test_helper"
2
3 class TracepointTest < ActiveSupport::TestCase
4   def test_timestamp_required
5     tracepoint = create(:tracepoint)
6     assert tracepoint.valid?
7     tracepoint.timestamp = nil
8     assert !tracepoint.valid?
9   end
10
11   # Ensure the lat/lon is formatted as a decimal e.g. not 4.0e-05
12   def test_lat_lon_xml_format
13     tracepoint = build(:tracepoint, :latitude => 0.00004 * GeoRecord::SCALE, :longitude => 0.00008 * GeoRecord::SCALE)
14
15     assert_match /lat="0.0000400"/, tracepoint.to_xml_node.to_s
16     assert_match /lon="0.0000800"/, tracepoint.to_xml_node.to_s
17   end
18 end