so_far_so_good 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/script/bootstrap ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ bundle install
4
+ bundle exec rake install
data/script/cibuild ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ bundle exec rake test
data/script/console ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ bundle exec pry -r './lib/so_far_so_good.rb'
data/script/release ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ bundle exec rake release
data/script/vendor ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ rm -Rf ./vendor/*
4
+ wget http://www.gpo.gov/fdsys/pkg/CFR-2010-title48-vol2/xml/CFR-2010-title48-vol2-chap1-subchapH.xml -P vendor
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'so_far_so_good/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "so_far_so_good"
8
+ spec.version = SoFarSoGood::VERSION
9
+ spec.authors = ["Ben Balter"]
10
+ spec.email = ["ben.balter@github.com"]
11
+ spec.summary = ""
12
+ spec.description = ""
13
+ spec.homepage = "https://github.com/benbalter/so_far_so_good"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "nokogiri"
22
+ spec.add_dependency "terminal-table"
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency('pry', '~> 0.9')
26
+ spec.add_development_dependency('shoulda', '~> 3.5')
27
+
28
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ require 'minitest/autorun'
4
+ require 'shoulda'
5
+
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+
8
+ require './lib/so_far_so_good.rb'
@@ -0,0 +1,30 @@
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 the rows" do
13
+ assert_equal 567, SoFarSoGood::Clauses.send(:rows).count
14
+ assert_equal ["52.200", "Scope of subpart."], SoFarSoGood::Clauses.send(:rows).first
15
+ end
16
+
17
+ should "parse section numbers" do
18
+ assert_equal 616, SoFarSoGood::Clauses.numbers.count
19
+ assert_equal "52.200", SoFarSoGood::Clauses.numbers.first
20
+ end
21
+
22
+ should "parse section descriptions" do
23
+ assert_equal 616, SoFarSoGood::Clauses.descriptions.count
24
+ assert_equal "Scope of subpart.", SoFarSoGood::Clauses.descriptions.first
25
+ end
26
+
27
+ should "put out valid JSON" do
28
+ assert !!JSON.parse(SoFarSoGood::Clauses.list.to_json)
29
+ end
30
+ end
@@ -0,0 +1,12 @@
1
+ require 'helper'
2
+
3
+ class TestSoFarSoGood < Minitest::Test
4
+ should "figure out the vendor directory" do
5
+ assert File.exists?(SoFarSoGood.vendor_directory)
6
+ end
7
+
8
+ should "return the clause hash" do
9
+ assert_equal Array, SoFarSoGood.clauses.class
10
+ assert_equal 616, SoFarSoGood.clauses.count
11
+ end
12
+ end