-
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 #138 from collectionspace/bugfix-unknown-term-from…
…-nil-str Bugfix unknown term from nil str
- Loading branch information
Showing
6 changed files
with
60 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module CollectionSpace | ||
module Mapper | ||
# Base class for application-specific errors | ||
class Error < StandardError | ||
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
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.0' | ||
VERSION = '4.0.1' | ||
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,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe CollectionSpace::Mapper::UnknownTerm do | ||
describe '.from_string' do | ||
let(:result){ described_class.from_string(str) } | ||
|
||
context 'with valid string (3 parts, separated by `|||`)' do | ||
let(:str){ 'a|||b|||c' } | ||
|
||
it 'creates new as expected', :aggregate_failures do | ||
expect(result).to be_a(described_class) | ||
expect(result.type).to eq('a') | ||
expect(result.subtype).to eq('b') | ||
expect(result.display_name).to eq('c') | ||
expect(result.urn).to eq(str) | ||
end | ||
end | ||
|
||
context 'with nil' do | ||
let(:str){ nil } | ||
|
||
it 'fails', :aggregate_failures do | ||
expect{ result }.to raise_error(CS::Mapper::UnknownTerm::ReconstituteNilError) | ||
end | ||
end | ||
end | ||
end |