Sha256: 5e5d8b0da96698d0c5d9ca0dba79e8c9eff3402339eb074401705299204f658b
Contents?: true
Size: 1.03 KB
Versions: 6
Compression:
Stored size: 1.03 KB
Contents
require File.join(File.dirname(__FILE__), '..', '/test_helper') module Garb class ReportResponseTest < MiniTest::Unit::TestCase context "An instance of the ReportResponse class" do setup do @xml = File.read(File.join(File.dirname(__FILE__), '..', "/fixtures/report_feed.xml")) @response = ReportResponse.new(@xml) end should "parse xml response with happymapper" do h1 = {"city"=>"(not set)", "pageviews"=>"33", "country"=>"(not set)"} h2 = {"city"=>"Kabul", "pageviews"=>"2", "country"=>"Afghanistan"} h3 = {"city"=>"Tirana", "pageviews"=>"1", "country"=>"Albania"} OpenStruct.expects(:new).with(h1).returns('entry1') OpenStruct.expects(:new).with(h2).returns('entry2') OpenStruct.expects(:new).with(h3).returns('entry3') assert_equal(['entry1', 'entry2', 'entry3'], @response.parse) end should "have results or parse them" do @response.expects(:parse) @response.results end end end end
Version data entries
6 entries across 6 versions & 1 rubygems