spec/unit/view_spec.rb in inqlude-0.8.0 vs spec/unit/view_spec.rb in inqlude-0.9.0

- old
+ new

@@ -42,20 +42,38 @@ v = View.new mh expect(v.commercial_libraries.count).to eq mh.commercial_libraries.count expect(v.commercial_libraries.first.name).to eq mh.commercial_libraries.first.name end + + it "returns list of latest libraries" do + mh = ManifestHandler.new settings + mh.read_remote + v = View.new mh + + expect(v.latest_libraries.count).to eq mh.latest_libraries.count + expect(v.latest_libraries.first.name).to eq mh.latest_libraries.first.name + end it "returns group" do mh = ManifestHandler.new settings mh.read_remote v = View.new mh v.group_name = "kde-frameworks" expect(v.group.count).to eq mh.group("kde-frameworks").count expect(v.group.first.name).to eq mh.group("kde-frameworks").first.name end + + it "returns topic" do + mh = ManifestHandler.new settings + mh.read_remote + v = View.new mh + + expect(v.topic("API").count).to eq 2 + expect(v.topic("API").first.name).to eq 'awesomelib' + end end context "generic manifest and one release" do include GivenFilesystemSpecHelpers @@ -171,6 +189,56 @@ it "returns if there are more URLs" do expect(@view.more_urls?).to be true end end + context "templates" do + include_context "manifest_files" + + include GivenFilesystemSpecHelpers + + use_given_filesystem + + before(:each) do + mh = ManifestHandler.new(settings) + mh.read_remote + + v = View.new mh + v.templates = "one-column" + + dir = given_directory + + v.create(dir) + @path = File.join(dir, "index.html") + end + + it "generates templates" do + expect(File.exists?(@path)).to be true + end + + it "checks content" do + html_data = File.read(@path) + + nokogiri_object = Nokogiri::HTML(html_data) + paragraphs_content = nokogiri_object.xpath("//p").to_s + + expected_content = + '<p> + The goal of Inqlude is to provide a comprehensive listing of all + existing libraries for developers of Qt applications. If you are creating + applications using the <a href="http://qt-project.org">Qt toolkit</a>, and + are looking for libraries, components + or modules to use, Inqlude is the place where you find all information and + pointers to get started. + </p><p> + This is a young project, we are still collecting information, and are + building up the web site and the tools around it. If you would like to get + involved, read more about <a href="contribute.html">how to contribute</a>, or go + to the mailing list + <a href="https://mail.kde.org/mailman/listinfo/inqlude">inqlude.kde.org</a> + to directly talk to us. See you there. + </p>' + + expect(paragraphs_content).to eq(expected_content) + end + end end