diff --git a/CHANGELOG.md b/CHANGELOG.md index 76a5750..2c6fd4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/epuber/book/contributor.rb b/lib/epuber/book/contributor.rb index b3c17a9..d8fa521 100644 --- a/lib/epuber/book/contributor.rb +++ b/lib/epuber/book/contributor.rb @@ -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 diff --git a/lib/epuber/from_file/bookspec_generator.rb b/lib/epuber/from_file/bookspec_generator.rb index 818feba..a73807e 100644 --- a/lib/epuber/from_file/bookspec_generator.rb +++ b/lib/epuber/from_file/bookspec_generator.rb @@ -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 diff --git a/spec/unit/book/contributor_spec.rb b/spec/unit/book/contributor_spec.rb index 132eea0..ecbf4d4 100644 --- a/spec/unit/book/contributor_spec.rb +++ b/spec/unit/book/contributor_spec.rb @@ -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