-
Notifications
You must be signed in to change notification settings - Fork 2
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 #19 from UNC-Libraries/excise-derivative-records
Excise derivative records into addon gem
- Loading branch information
Showing
9 changed files
with
88 additions
and
255 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Sierra | ||
VERSION = '0.3.1'.freeze | ||
VERSION = '0.3.2'.freeze | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,11 @@ module Sierra | |
Sierra::DB.write_results(io) | ||
expect(io.string[0..1]).to eq('id') | ||
end | ||
|
||
it 'uses passed headers when present' do | ||
Sierra::DB.write_results(io, headers: ['ego']) | ||
expect(io.string[0..2]).to eq('ego') | ||
end | ||
end | ||
|
||
context 'with include_headers: false' do | ||
|
@@ -35,23 +40,47 @@ module Sierra | |
end | ||
end | ||
|
||
context 'with format: csv (default)' do | ||
context 'with format: csv' do | ||
it 'writes to a csv' do | ||
Sierra::DB.write_results(io, format: :csv) | ||
expect(io.string.each_line.first.split(',').first).to eq('id') | ||
end | ||
end | ||
|
||
context ' with format: xlsx (default)' do | ||
context 'with format: xlsx' do | ||
xit 'writes to an xlsx' do | ||
end | ||
end | ||
|
||
context 'when passed an array of objects that respond to :values)' do | ||
it 'writes the values to output as rows' do | ||
Sierra::DB.write_results(io, results: [{a: 'foo', b: 'bar'}], | ||
include_headers: false) | ||
expect(io.string[0..6]).to eq("foo\tbar") | ||
end | ||
end | ||
|
||
context 'otherwise' do | ||
it 'writes query results' do | ||
Sierra::DB.write_results(io, include_headers: false) | ||
expect(io.string[0..1]).to match(/[0-9]*/) | ||
end | ||
end | ||
end | ||
|
||
describe '.mail_results' do | ||
end | ||
|
||
describe '.yield_email' do | ||
it 'returns email address in Query.emails for given key' do | ||
Sierra::DB::Query.emails(StringIO.new("default_email: [email protected]\nother_email: [email protected]")) | ||
expect(Sierra::DB.yield_email('other_email')).to eq('[email protected]') | ||
end | ||
|
||
it 'returns email address in Query.emails for "default_email"' do | ||
Sierra::DB::Query.emails(StringIO.new("default_email: [email protected]\nother_email: [email protected]")) | ||
expect(Sierra::DB.yield_email).to eq('[email protected]') | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.