forked from rubyist/guppy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_gpx_parser.rb
31 lines (25 loc) · 905 Bytes
/
test_gpx_parser.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'helper'
class TestGpxParser < Test::Unit::TestCase
context "existence" do
should "exist" do
assert Guppy::GpxParser.new('foo.gpx')
end
end
context "opening" do
should "should create the tcx parser object" do
flexmock(Guppy::TcxParser).should_receive(:new).with('foo.tcx').and_return(flexmock('parser', :parse => '')).once
Guppy::TcxParser.open('foo.tcx')
end
should "parse the file" do
parser = flexmock('parser')
parser.should_receive(:parse).once
flexmock(Guppy::TcxParser).should_receive(:new).and_return(parser)
Guppy::TcxParser.open('foo.tcx')
end
should "return the TcxParser object" do
parser = flexmock('parser', :parse => '')
flexmock(Guppy::TcxParser).should_receive(:new).with('foo.tcx').and_return(parser)
assert_equal parser, Guppy::TcxParser.open('foo.tcx')
end
end
end