Sha256: eb6771dc467ba604e7d212452d4de82d0d4d80684fd10b68827a6b4ab68fe4ad
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require 'helper' class TestSoFarSoGoodSubchapter < Minitest::Test def setup @subchapter = SoFarSoGood.far end should "know the subchapter file" do assert File.exists? @subchapter.send :source_path end should "parse the XML" do assert Nokogiri::XML::Document, @subchapter.send(:doc).class end should "parse subpart numbers" do assert_equal 635, @subchapter.numbers.count assert_equal "52.200", @subchapter.numbers.first end should "parse subpart descriptions" do assert_equal 635, @subchapter.subjects.count assert_equal "Scope of subpart.", @subchapter.subjects.first end should "put out valid JSON" do assert !!JSON.parse(@subchapter.subparts.to_json) end should "return a particular subpart" do assert_equal "52.202-1", @subchapter["52.202-1"].number end should "return all subparts" do assert_equal 635, @subchapter.subparts.count end should "filter reserved subparts" do assert_equal 585, @subchapter.subparts(:reserved => false).count end should "build the markdown table" do assert_includes @subchapter.to_md, "-|\n| 52.200 | Scope of subpart." end should "exclude reserved in markdown table when asked" do refute_includes @subchapter.to_md(:reserved => false), "[Reserved]" end should "include links in markdown table when asked" do assert_includes @subchapter.to_md(:links => true), "[52.252-6](http://www.law.cornell.edu/cfr/text/48/52.252-6)" end should "output valid CSV" do csv = CSV.parse @subchapter.to_csv assert_equal ["52.200", "Scope of subpart."], csv[1] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
so_far_so_good-1.2.0 | test/so_far_so_good_subchapter_test.rb |