Sha256: cc9c4269e2ad2b4ef6c15e1b47808a8bf8d6b1d074ce0898e3379f7658d173c1
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
require 'webmock/rspec' describe AnimeNewsNetwork::Encyclopedia do before do reports_xml = File.new(File.expand_path('../../resources/reports_xml_id_155_type_anime', __FILE__)) stub_http_request(:get, "cdn.animenewsnetwork.com/encyclopedia/reports.xml") .with(query: { id: 155, type: "anime" }) .to_return(body: reports_xml) reports_xml = File.new(File.expand_path('../../resources/reports_xml_id_155_type_anime', __FILE__)) stub_http_request(:get, "cdn.animenewsnetwork.com/encyclopedia/reports.xml") .with(query: { id: 155, type: "anime", nskip: 10, nlist: 10 }) .to_return(body: reports_xml) reports_xml = File.new(File.expand_path('../../resources/reports_xml_id_155_type_anime', __FILE__)) stub_http_request(:get, "cdn.animenewsnetwork.com/encyclopedia/reports.xml") .with(query: { id: 155, type: "anime", nlist: "all" }) .to_return(body: reports_xml) api_xml = File.new(File.expand_path('../../resources/api_xml_anime_4658', __FILE__)) stub_http_request(:get, "cdn.animenewsnetwork.com/encyclopedia/api.xml") .with(query: { anime: 4658 }) .to_return(body: api_xml) end let(:ann) { AnimeNewsNetwork::Encyclopedia.new } describe "GET reports" do subject { ann.get_reports(id: 155, type: 'anime') } it { should be_a Nokogiri::XML::Document } end describe "GET reports nskip & nlist" do subject { ann.get_reports(id: 155, type: 'anime', nskip: 10, nlist: 10) } it { should be_a Nokogiri::XML::Document } end describe "GET reports nlist all" do subject { ann.get_reports(id: 155, type: 'anime', nlist: 'all') } it { should be_a Nokogiri::XML::Document } end describe "GET details" do subject { ann.get_details(id: 4658, type: 'anime') } it { should be_a Nokogiri::XML::Document } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
animenewsnetwork-0.0.2 | spec/unit/encyclopedia_spec.rb |