Sha256: fc24c216300b7b36d990362077c5d63f13d52f153d4674289def3d95a4b1e72b
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require 'spec_helper' class XmlResponseExample < ActiveRestClient::Base base_url "http://www.example.com/v1/" get :atom, "/atom", fake: %Q{ <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Example Feed</title> <link href="http://example.org/"/> <updated>2003-12-13T18:30:02Z</updated> <author> <name>John Doe</name> </author> <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> <entry> <title>Atom-Powered Robots Run Amok</title> <link href="http://example.org/2003/12/13/atom03"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> <updated>2003-12-13T18:30:02Z</updated> <summary>Some text.</summary> </entry> <entry> <title>Something else cool happened</title> <link href="http://example.org/2015/08/11/andyjeffries"/> <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6b</id> <updated>2015-08-11T18:30:02Z</updated> <summary>Some other text.</summary> </entry> </feed>}.strip_heredoc, fake_content_type: "application/xml" end describe XmlResponseExample do it "should parse the response without error" do expect { XmlResponseExample.atom }.to_not raise_error end it "provides the feed title" do @atom = XmlResponseExample.atom expect(@atom.feed.title).to eq("Example Feed") end it "each entry item has a title" do @atom = XmlResponseExample.atom expect(@atom.feed.entry.class).to eq(ActiveRestClient::ResultIterator) end it "provides a list of entry items" do @atom = XmlResponseExample.atom expect(@atom.feed.entry[0].title).to eq("Atom-Powered Robots Run Amok") expect(@atom.feed.entry[1].title).to eq("Something else cool happened") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_rest_client-1.1.9 | spec/lib/xml_spec.rb |