require "test_helper" describe PlayWhe::Parser do describe "::parse" do it "returns a list of the results it finds in the order it finds it" do html_results = "

Draw #: 1
Date: 04-Jul-94
Mark Drawn: 15
Drawn at: AM


Draw #: 2
Date: 04-Jul-94
Mark Drawn: 11
Drawn at: PM


Draw #: 3
Date: 05-Jul-94
Mark Drawn: 36
Drawn at: AM


Draw #: 4
Date: 05-Jul-94
Mark Drawn: 31
Drawn at: PM


Draw #: 5
Date: 06-Jul-94
Mark Drawn: 12
Drawn at: AM


Draw #: 6
Date: 06-Jul-94
Mark Drawn: 36
Drawn at: PM


Draw #: 7
Date: 07-Jul-94
Mark Drawn: 6
Drawn at: AM

" results = PlayWhe::Parser.parse(html_results) expect(results.length).must_equal 7 expect(results[0]).must_equal \ PlayWhe::Result.new \ draw: 1, date: "1994-07-04", mark: 15, period: "AM" expect(results[1]).must_equal \ PlayWhe::Result.new \ draw: 2, date: "1994-07-04", mark: 11, period: "PM" expect(results[2]).must_equal \ PlayWhe::Result.new \ draw: 3, date: "1994-07-05", mark: 36, period: "AM" expect(results[3]).must_equal \ PlayWhe::Result.new \ draw: 4, date: "1994-07-05", mark: 31, period: "PM" expect(results[4]).must_equal \ PlayWhe::Result.new \ draw: 5, date: "1994-07-06", mark: 12, period: "AM" expect(results[5]).must_equal \ PlayWhe::Result.new \ draw: 6, date: "1994-07-06", mark: 36, period: "PM" expect(results[6]).must_equal \ PlayWhe::Result.new \ draw: 7, date: "1994-07-07", mark: 6, period: "AM" end end end