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.
@@ -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