Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## v0.12.2 (2026-02-07)

- Drop usage of `String#mb_chars` because of deprecation on ActiveSupport side

## v0.12.1 (2026-01-06)

- Allow to use Sinatra v4, Thin v2 and ActiveSupport v8

## v0.12.0 (2025-02-07)

- Add basic support for SVG files (Epuber will correctly find them even when extension is missing) [#66](https://github.com/epuber-io/epuber/issues/66)
Expand Down
2 changes: 1 addition & 1 deletion lib/epuber/book/contributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def pretty_name
# @return [String]
#
def file_as
"#{@last_name.mb_chars.upcase}, #{@first_name}"
"#{@last_name.upcase}, #{@first_name}"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/epuber/from_file/bookspec_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def decrease_indent
# @return [Boolean]
#
def contributor_file_as_eq?(file_as_a, file_as_b)
file_as_a == file_as_b || file_as_a.mb_chars.downcase == file_as_b.mb_chars.downcase
file_as_a == file_as_b || file_as_a.downcase == file_as_b.downcase
end

# @param [String] href
Expand Down
41 changes: 18 additions & 23 deletions spec/unit/book/contributor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,36 @@
module Epuber
class Book
describe Contributor do
before do
@contributor = described_class.new('Jason Fried', 'FRIED, Jason', 'aut')
end

it 'returns same values' do
expect(@contributor.pretty_name).to eq 'Jason Fried'
expect(@contributor.file_as).to eq 'FRIED, Jason'
expect(@contributor.role).to eq 'aut'
contributor = described_class.new('Jason Fried', 'FRIED, Jason', 'aut')

expect(contributor.pretty_name).to eq 'Jason Fried'
expect(contributor.file_as).to eq 'FRIED, Jason'
expect(contributor.role).to eq 'aut'
end
end

describe NormalContributor do
before do
@contributor = described_class.new('Jason', 'Fried', 'aut')
end

it 'formats file_as' do
expect(@contributor.file_as).to eq 'FRIED, Jason'
end
it 'automatically formats file_as and pretty_name' do
contributor = described_class.new('Jason', 'Fried', 'aut')

it 'formats pretty_name' do
expect(@contributor.pretty_name).to eq 'Jason Fried'
end

it 'pretty_name is readonly' do
expect(contributor.file_as).to eq 'FRIED, Jason'
expect(contributor.pretty_name).to eq 'Jason Fried'
expect do
@contributor.pretty_name = ''
contributor.pretty_name = ''
end.to raise_error NameError
end

it 'file_as is readonly' do
expect do
@contributor.file_as = ''
contributor.file_as = ''
end.to raise_error NameError
end

it 'automatically formats file_as and pretty_name with unicode characters' do
contributor = described_class.new('Ěščřžýáíé', 'Úůňó', 'aut')

expect(contributor.file_as).to eq 'ÚŮŇÓ, Ěščřžýáíé'
expect(contributor.pretty_name).to eq 'Ěščřžýáíé Úůňó'
end
end

describe 'Epuber::Contributor.from_obj' do
Expand Down