spec/unit/translation_spec.rb in loaf-0.4.0 vs spec/unit/translation_spec.rb in loaf-0.5.0
- old
+ new
@@ -4,19 +4,21 @@
RSpec.describe Loaf::Translation do
before { I18n.backend = I18n::Backend::Simple.new }
+ after { I18n.backend.reload! }
+
it 'translates breadcrumb title' do
- I18n.backend.store_translations 'en', breadcrumbs: { home: 'Home'}
- expect(described_class.breadcrumb_title('breadcrumbs.home')).to eql('Home')
+ I18n.backend.store_translations 'en', loaf: { breadcrumbs: { home: 'Home'}}
+ expect(described_class.find_title('home')).to eql('Home')
end
- it 'translates breadcrumb name with default scope' do
+ it 'does not translates breadcrumb name with missing scope' do
I18n.backend.store_translations 'en', breadcrumbs: {home: 'Home'}
- expect(described_class.breadcrumb_title('home')).to eql('Home')
+ expect(described_class.find_title('home')).to eql('home')
end
it 'translates breadcrumb name using default option' do
- expect(described_class.breadcrumb_title('home', default: 'breadcrumb default name')).to eql('breadcrumb default name')
+ expect(described_class.find_title('home', default: 'breadcrumb default name')).to eql('breadcrumb default name')
end
end