require "spec_helper" require "./lib/nicoapi/parser/tag_search" require "./spec/fixture" describe "TagSearch" do before do @instance = NicoAPI::Parser::TagSearch.new Fixture.tag_search_rss @instance.parse end shared_examples "url string" do specify { expect(subject).to match /(http|https)\:\/\/.+/ } end describe "tag" do subject { @instance.tag } specify { expect(subject).to be } end describe "publish_date" do subject { @instance.publish_date } specify { expect(subject).to be_kind_of(Time) } end describe "last_build_date" do subject { @instance.last_build_date } specify { expect(subject).to be_kind_of(Time) } end describe "item" do subject { @instance.items } specify { expect(subject).to be_kind_of(Array) } end describe "each item" do describe "title" do subject { @instance.items[0].title } specify { expect(subject).to be } end describe "video_id" do subject { @instance.items[0].video_id } specify { expect(subject).to match /(sm|nm)\d{1,}/ } end describe "url" do subject { @instance.items[0].url } it_behaves_like "url string" end describe "publish_date" do subject { @instance.items[0].url } it_behaves_like "url string" end describe "thumbnail_url" do subject { @instance.items[0].thumbnail_url } it_behaves_like "url string" end describe "length" do subject { @instance.items[0].length } specify { expect(subject).to be_kind_of(Fixnum) } end describe "description" do subject { @instance.items[0].description } specify { expect(subject).to be_kind_of(Object) } end describe "Description" do describe "raw_text" do subject { @instance.items[0].description.raw_text } specify { expect(subject).to be_kind_of(String) } end describe "text" do subject { @instance.items[0].description.text } specify { expect(subject).to be_kind_of(String) } end end end end