-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from collectionspace/chronic-date-parser-bugfix
Chronic date parser bugfix
- Loading branch information
Showing
5 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module CollectionSpace | ||
module Mapper | ||
VERSION = '4.0.2' | ||
VERSION = '4.0.3' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe CollectionSpace::Mapper::Dates::ChronicParser do | ||
subject(:parser){ described_class.new(str, handler) } | ||
let(:client){ anthro_client } | ||
let(:cache){ anthro_cache } | ||
let(:csid_cache){ anthro_csid_cache } | ||
let(:config){ CollectionSpace::Mapper::Config.new } | ||
let(:searcher) { CollectionSpace::Mapper::Searcher.new(client: client, config: config) } | ||
let(:handler){ CollectionSpace::Mapper::Dates::StructuredDateHandler.new(client: client, cache: cache, csid_cache: csid_cache, config: config, searcher: searcher) } | ||
|
||
describe '#mappable' do | ||
context 'with 2022-06-23' do | ||
let(:str){ '2022-06-23' } | ||
|
||
it 'returns expected' do | ||
expect(parser.mappable['dateEarliestScalarValue']).to eq('2022-06-23T00:00:00.000Z') | ||
end | ||
end | ||
|
||
context 'with 01-00-2000' do | ||
let(:str){ '01-00-2000' } | ||
|
||
it 'returns expected', :aggregate_failures do | ||
expect(parser.mappable['dateDisplayDate']).to eq(str) | ||
expect(parser.mappable['scalarValuesComputed']).to eq('false') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe CollectionSpace::Mapper::Dates::ServicesParser do | ||
subject(:parser){ described_class.new(str, handler) } | ||
let(:client){ anthro_client } | ||
let(:cache){ anthro_cache } | ||
let(:csid_cache){ anthro_csid_cache } | ||
let(:config){ CollectionSpace::Mapper::Config.new } | ||
let(:searcher) { CollectionSpace::Mapper::Searcher.new(client: client, config: config) } | ||
let(:handler){ CollectionSpace::Mapper::Dates::StructuredDateHandler.new(client: client, cache: cache, csid_cache: csid_cache, config: config, searcher: searcher) } | ||
|
||
describe '#mappable' do | ||
context 'with 2022-06-23' do | ||
let(:str){ '2022-06-23' } | ||
|
||
it 'returns expected' do | ||
expect(parser.mappable['dateEarliestScalarValue']).to eq('2022-06-23T00:00:00.000Z') | ||
end | ||
end | ||
|
||
context 'with 01-00-2000' do | ||
let(:str){ '01-00-2000' } | ||
|
||
it 'returns expected', :aggregate_failures do | ||
expect(parser.mappable['dateDisplayDate']).to eq(str) | ||
expect(parser.mappable['scalarValuesComputed']).to eq('false') | ||
end | ||
end | ||
end | ||
end |