so_far_so_good 0.0.3 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +54 -34
- data/lib/so_far_so_good/subchapter.rb +88 -0
- data/lib/so_far_so_good/{clause.rb → subpart.rb} +20 -5
- data/lib/so_far_so_good/version.rb +1 -1
- data/lib/so_far_so_good.rb +27 -5
- data/script/release +36 -1
- data/script/vendor +2 -1
- data/test/so_far_so_good_subchapter_test.rb +59 -0
- data/test/so_far_so_good_subpart_test.rb +59 -0
- data/test/so_far_so_good_test.rb +19 -6
- data/vendor/{CFR-2010-title48-vol2-chap1-subchapH.xml → CFR-2013-title48-vol2-chap1-subchapH.xml} +2664 -2225
- data/vendor/CFR-2013-title48-vol3-chap2-subchapH.xml +10668 -0
- metadata +10 -10
- data/lib/so_far_so_good/clauses.rb +0 -58
- data/output.json +0 -1
- data/test/so_far_so_good_clause_test.rb +0 -58
- data/test/so_far_so_good_clauses_test.rb +0 -49
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestSoFarSoGoodClause < Minitest::Test
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@nodes = SoFarSoGood::Clauses.send(:sections)
|
7
|
-
@clause = SoFarSoGood::Clause.new(@nodes[6])
|
8
|
-
end
|
9
|
-
|
10
|
-
should "Store the node" do
|
11
|
-
assert Nokogiri::XML::Element, @clause.node.class
|
12
|
-
end
|
13
|
-
|
14
|
-
should "expose the clause number" do
|
15
|
-
assert_equal "52.203-5", @clause.number
|
16
|
-
end
|
17
|
-
|
18
|
-
should "expose the clause subject" do
|
19
|
-
assert_equal "Covenant Against Contingent Fees.", @clause.subject
|
20
|
-
end
|
21
|
-
|
22
|
-
should "know the cite" do
|
23
|
-
assert_includes @clause.citation, "48 FR 42478"
|
24
|
-
end
|
25
|
-
|
26
|
-
should "know the clause body" do
|
27
|
-
assert_includes @clause.body, "As prescribed in 3.404,"
|
28
|
-
end
|
29
|
-
|
30
|
-
should "not include the extract in the clause body" do
|
31
|
-
refute_includes @clause.body, "The Contractor warrants that no person or agency"
|
32
|
-
end
|
33
|
-
|
34
|
-
should "know the clause extract" do
|
35
|
-
assert_includes @clause.extract, "The Contractor warrants that no person or agency"
|
36
|
-
end
|
37
|
-
|
38
|
-
should "know if its reserved" do
|
39
|
-
refute SoFarSoGood::Clauses["52.203-5"].reserved?
|
40
|
-
assert SoFarSoGood::Clauses["52.203-1"].reserved?
|
41
|
-
end
|
42
|
-
|
43
|
-
should "convert the body to markdown" do
|
44
|
-
assert_includes @clause.body(:format => :markdown), "As prescribed in 3.404, insert the following clause:\n\n"
|
45
|
-
end
|
46
|
-
|
47
|
-
should "convert the extract to markdown" do
|
48
|
-
assert_includes @clause.extract(:format => :markdown), "### Covenant Against Contingent Fees (APR 1984)\n\n(a)"
|
49
|
-
end
|
50
|
-
|
51
|
-
should "build the link" do
|
52
|
-
assert_equal "http://www.law.cornell.edu/cfr/text/48/52.203-5", @clause.link
|
53
|
-
end
|
54
|
-
|
55
|
-
should "put out valid json" do
|
56
|
-
assert JSON.parse SoFarSoGood::Clauses["52.203-5"].to_json
|
57
|
-
end
|
58
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestSoFarSoGoodClauses < Minitest::Test
|
4
|
-
should "know the clauses file" do
|
5
|
-
assert File.exists? SoFarSoGood::Clauses.send :source_path
|
6
|
-
end
|
7
|
-
|
8
|
-
should "parse the XML" do
|
9
|
-
assert Nokogiri::XML::Document, SoFarSoGood::Clauses.send(:doc).class
|
10
|
-
end
|
11
|
-
|
12
|
-
should "parse section numbers" do
|
13
|
-
assert_equal 616, SoFarSoGood::Clauses.numbers.count
|
14
|
-
assert_equal "52.200", SoFarSoGood::Clauses.numbers.first
|
15
|
-
end
|
16
|
-
|
17
|
-
should "parse section descriptions" do
|
18
|
-
assert_equal 616, SoFarSoGood::Clauses.descriptions.count
|
19
|
-
assert_equal "Scope of subpart.", SoFarSoGood::Clauses.descriptions.first
|
20
|
-
end
|
21
|
-
|
22
|
-
should "put out valid JSON" do
|
23
|
-
assert !!JSON.parse(SoFarSoGood::Clauses.list.to_json)
|
24
|
-
end
|
25
|
-
|
26
|
-
should "return a particular clause" do
|
27
|
-
assert_equal "52.202-1", SoFarSoGood::Clauses["52.202-1"].number
|
28
|
-
end
|
29
|
-
|
30
|
-
should "return all clauses" do
|
31
|
-
assert_equal 616, SoFarSoGood::Clauses.list.count
|
32
|
-
end
|
33
|
-
|
34
|
-
should "filter reserved clauses" do
|
35
|
-
assert_equal 567, SoFarSoGood::Clauses.list(:exclude_reserved => true).count
|
36
|
-
end
|
37
|
-
|
38
|
-
should "build the markdown table" do
|
39
|
-
assert_includes SoFarSoGood::Clauses.to_md, "-|\n| 52.200 | Scope of subpart."
|
40
|
-
end
|
41
|
-
|
42
|
-
should "exclude reserved in markdown table when asked" do
|
43
|
-
refute_includes SoFarSoGood::Clauses.to_md(:exclude_reserved => true), "[Reserved]"
|
44
|
-
end
|
45
|
-
|
46
|
-
should "inlcude links in markdown table when asked" do
|
47
|
-
assert_includes SoFarSoGood::Clauses.to_md(:links => true), "[52.252-6](http://www.law.cornell.edu/cfr/text/48/52.252-6)"
|
48
|
-
end
|
49
|
-
end
|