Sha256: 8e22ef8ceb2e58b43b0b6decaae70c6bcabcfb97acef27fc34155542918ad800
Contents?: true
Size: 1.04 KB
Versions: 9
Compression:
Stored size: 1.04 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
9 entries across 9 versions & 3 rubygems