geo_combine 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/spec/helpers.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'json'
2
+
3
+ module Helpers
4
+ # From https://gist.github.com/ascendbruce/7070951
5
+ def valid_json?(json)
6
+ begin
7
+ JSON.parse(json)
8
+ return true
9
+ rescue Exception => e
10
+ return false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe GeoCombine::Fgdc do
4
+ include XmlDocs
5
+ let(:fgdc_object){ GeoCombine::Fgdc.new(tufts_fgdc) }
6
+ describe '#initialize' do
7
+ it 'returns an instantiated Fgdc object' do
8
+ expect(fgdc_object).to be_an GeoCombine::Fgdc
9
+ end
10
+ end
11
+ describe '#xsl' do
12
+ it 'should be defined' do
13
+ expect(fgdc_object.xsl).to be_an Nokogiri::XSLT::Stylesheet
14
+ end
15
+ end
16
+ describe '#to_geoblacklight' do
17
+ it 'returns a GeoCombine::Geoblacklight object' do
18
+ pending('fgdc2geoBL.xsl is incomplete and can cause errors')
19
+ expect(fgdc_object.to_geoblacklight).to be_an GeoCombine::Geoblacklight
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe GeoCombine::Geoblacklight do
4
+ include XmlDocs
5
+ let(:geobl_object){ GeoCombine::Geoblacklight.new(stanford_geobl) }
6
+ describe '#to_json' do
7
+ it 'returns valid json' do
8
+ expect(valid_json?(geobl_object.to_json)).to be_truthy
9
+ end
10
+ end
11
+ describe '#to_hash' do
12
+ it 'returns a hash' do
13
+ expect(geobl_object.to_hash).to be_an Hash
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe GeoCombine::Iso19139 do
4
+ include XmlDocs
5
+ let(:iso_object){ GeoCombine::Iso19139.new(stanford_iso) }
6
+ describe '#initialize' do
7
+ it 'returns an instantiated Iso19139 object' do
8
+ expect(iso_object).to be_an GeoCombine::Iso19139
9
+ end
10
+ end
11
+ describe '#xsl' do
12
+ it 'should be defined' do
13
+ expect(iso_object.xsl).to be_an Nokogiri::XSLT::Stylesheet
14
+ end
15
+ end
16
+ describe '#to_geoblacklight' do
17
+ it 'should create a GeoCombine::Geoblacklight object' do
18
+ expect(iso_object.to_geoblacklight).to be_an GeoCombine::Geoblacklight
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe GeoCombine::Metadata do
4
+ include XmlDocs
5
+ describe '#initialize' do
6
+ it 'reads metadata from file if File is readable' do
7
+ expect(File).to receive(:readable?).and_return(true)
8
+ expect(File).to receive(:read).and_return(simple_xml)
9
+ metadata_object = GeoCombine::Metadata.new('./tmp/fake/file/location')
10
+ expect(metadata_object).to be_an GeoCombine::Metadata
11
+ expect(metadata_object.metadata).to be_an Nokogiri::XML::Document
12
+ expect(metadata_object.metadata.css('Author').count).to eq 2
13
+ end
14
+ it 'reads metadata from parameter if File is not readable' do
15
+ metadata_object = GeoCombine::Metadata.new(simple_xml)
16
+ expect(metadata_object).to be_an GeoCombine::Metadata
17
+ expect(metadata_object.metadata).to be_an Nokogiri::XML::Document
18
+ expect(metadata_object.metadata.css('Author').count).to eq 2
19
+ end
20
+ end
21
+ # GeoCombine subclasses should individually test `to_geoblacklight` method
22
+ end
@@ -0,0 +1,99 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ require 'coveralls'
20
+ Coveralls.wear!
21
+
22
+ require 'geo_combine'
23
+ require 'fixtures/xml_docs'
24
+ require 'helpers'
25
+
26
+ RSpec.configure do |config|
27
+ config.include Helpers
28
+ # rspec-expectations config goes here. You can use an alternate
29
+ # assertion/expectation library such as wrong or the stdlib/minitest
30
+ # assertions if you prefer.
31
+ config.expect_with :rspec do |expectations|
32
+ # This option will default to `true` in RSpec 4. It makes the `description`
33
+ # and `failure_message` of custom matchers include text for helper methods
34
+ # defined using `chain`, e.g.:
35
+ # be_bigger_than(2).and_smaller_than(4).description
36
+ # # => "be bigger than 2 and smaller than 4"
37
+ # ...rather than:
38
+ # # => "be bigger than 2"
39
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
40
+ end
41
+
42
+ # rspec-mocks config goes here. You can use an alternate test double
43
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
44
+ config.mock_with :rspec do |mocks|
45
+ # Prevents you from mocking or stubbing a method that does not exist on
46
+ # a real object. This is generally recommended, and will default to
47
+ # `true` in RSpec 4.
48
+ mocks.verify_partial_doubles = true
49
+ end
50
+
51
+ # The settings below are suggested to provide a good initial experience
52
+ # with RSpec, but feel free to customize to your heart's content.
53
+ =begin
54
+ # These two settings work together to allow you to limit a spec run
55
+ # to individual examples or groups you care about by tagging them with
56
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
57
+ # get run.
58
+ config.filter_run :focus
59
+ config.run_all_when_everything_filtered = true
60
+
61
+ # Limits the available syntax to the non-monkey patched syntax that is
62
+ # recommended. For more details, see:
63
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
64
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
66
+ config.disable_monkey_patching!
67
+
68
+ # This setting enables warnings. It's recommended, but in some cases may
69
+ # be too noisy due to issues in dependencies.
70
+ config.warnings = true
71
+
72
+ # Many RSpec users commonly either run the entire suite or an individual
73
+ # file, and it's useful to allow more verbose output when running an
74
+ # individual spec file.
75
+ if config.files_to_run.one?
76
+ # Use the documentation formatter for detailed output,
77
+ # unless a formatter has already been configured
78
+ # (e.g. via a command-line flag).
79
+ config.default_formatter = 'doc'
80
+ end
81
+
82
+ # Print the 10 slowest examples and example groups at the
83
+ # end of the spec run, to help surface which specs are running
84
+ # particularly slow.
85
+ config.profile_examples = 10
86
+
87
+ # Run specs in random order to surface order dependencies. If you find an
88
+ # order dependency and want to debug it, you can fix the order by providing
89
+ # the seed, which is printed after each run.
90
+ # --seed 1234
91
+ config.order = :random
92
+
93
+ # Seed global randomization in this process using the `--seed` CLI option.
94
+ # Setting this allows you to use `--seed` to deterministically reproduce
95
+ # test failures related to randomization by passing the same `--seed` value
96
+ # as the one that triggered the failure.
97
+ Kernel.srand config.seed
98
+ =end
99
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_combine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Reed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rsolr
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
68
  version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: A Ruby toolkit for managing geospatial metadata
56
84
  email:
57
85
  - pjreed@stanford.edu
@@ -60,14 +88,28 @@ extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
62
90
  - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
63
93
  - Gemfile
64
94
  - LICENSE.txt
65
95
  - README.md
66
96
  - Rakefile
67
97
  - geo_combine.gemspec
68
98
  - lib/geo_combine.rb
99
+ - lib/geo_combine/fgdc.rb
100
+ - lib/geo_combine/geoblacklight.rb
101
+ - lib/geo_combine/iso19139.rb
69
102
  - lib/geo_combine/version.rb
70
103
  - lib/tasks/geo_combine.rake
104
+ - lib/xslt/fgdc2geoBL.xsl
105
+ - lib/xslt/iso2geoBL.xsl
106
+ - spec/fixtures/xml_docs.rb
107
+ - spec/helpers.rb
108
+ - spec/lib/geo_combine/fgdc_spec.rb
109
+ - spec/lib/geo_combine/geoblacklight_spec.rb
110
+ - spec/lib/geo_combine/iso19139_spec.rb
111
+ - spec/lib/geo_combine_spec.rb
112
+ - spec/spec_helper.rb
71
113
  homepage: ''
72
114
  licenses:
73
115
  - Apache
@@ -92,4 +134,12 @@ rubygems_version: 2.4.5
92
134
  signing_key:
93
135
  specification_version: 4
94
136
  summary: A Ruby toolkit for managing geospatial metadata
95
- test_files: []
137
+ test_files:
138
+ - spec/fixtures/xml_docs.rb
139
+ - spec/helpers.rb
140
+ - spec/lib/geo_combine/fgdc_spec.rb
141
+ - spec/lib/geo_combine/geoblacklight_spec.rb
142
+ - spec/lib/geo_combine/iso19139_spec.rb
143
+ - spec/lib/geo_combine_spec.rb
144
+ - spec/spec_helper.rb
145
+ has_rdoc: