|
522 | 522 | end |
523 | 523 |
|
524 | 524 | context "when getting a localized field" do |
| 525 | + with_default_i18n_configs |
| 526 | + |
525 | 527 | before do |
526 | 528 | I18n.locale = :en |
527 | 529 | d = Dictionary.create!(description: 'english-text') |
|
530 | 532 | d.save! |
531 | 533 | end |
532 | 534 |
|
533 | | - after do |
534 | | - I18n.locale = :en |
535 | | - end |
536 | | - |
537 | 535 | let(:criteria) do |
538 | 536 | Dictionary.all.tap do |crit| |
539 | 537 | crit.documents = [ Dictionary.first ] |
|
576 | 574 | end |
577 | 575 |
|
578 | 576 | context 'when fallbacks are enabled with a locale list' do |
579 | | - with_i18n_fallbacks |
| 577 | + require_fallbacks |
| 578 | + with_default_i18n_configs |
580 | 579 |
|
581 | | - around(:all) do |example| |
582 | | - prev_fallbacks = I18n.fallbacks.dup |
| 580 | + before do |
583 | 581 | I18n.fallbacks[:he] = [ :en ] |
584 | | - example.run |
585 | | - I18n.fallbacks = prev_fallbacks |
586 | | - end |
587 | | - |
588 | | - after do |
589 | | - I18n.locale = :en |
590 | 582 | end |
591 | 583 |
|
592 | 584 | let(:distinct) do |
|
602 | 594 | end |
603 | 595 |
|
604 | 596 | context "when the localized field is embedded" do |
| 597 | + with_default_i18n_configs |
| 598 | + |
605 | 599 | let(:person) do |
606 | 600 | p = Passport.new |
607 | 601 | I18n.locale = :en |
|
612 | 606 | Person.create!(passport: p, employer_id: 12345) |
613 | 607 | end |
614 | 608 |
|
615 | | - after do |
616 | | - I18n.locale = :en |
617 | | - end |
618 | | - |
619 | 609 | let(:criteria) do |
620 | 610 | Person.where(employer_id: 12345).tap do |crit| |
621 | 611 | crit.documents = [ person ] |
|
1697 | 1687 | end |
1698 | 1688 |
|
1699 | 1689 | context 'when plucking a localized field' do |
| 1690 | + with_default_i18n_configs |
1700 | 1691 |
|
1701 | 1692 | before do |
1702 | 1693 | I18n.locale = :en |
|
1706 | 1697 | d.save! |
1707 | 1698 | end |
1708 | 1699 |
|
1709 | | - after do |
1710 | | - I18n.locale = :en |
1711 | | - end |
1712 | | - |
1713 | 1700 | let(:criteria) do |
1714 | 1701 | Dictionary.all.tap do |crit| |
1715 | 1702 | crit.documents = [ Dictionary.first ] |
|
1766 | 1753 | end |
1767 | 1754 |
|
1768 | 1755 | context 'when fallbacks are enabled with a locale list' do |
1769 | | - with_i18n_fallbacks |
| 1756 | + require_fallbacks |
| 1757 | + with_default_i18n_configs |
1770 | 1758 |
|
1771 | | - around(:all) do |example| |
1772 | | - prev_fallbacks = I18n.fallbacks.dup |
| 1759 | + before do |
1773 | 1760 | I18n.fallbacks[:he] = [ :en ] |
1774 | | - example.run |
1775 | | - I18n.fallbacks = prev_fallbacks |
1776 | | - end |
1777 | | - |
1778 | | - after do |
1779 | | - I18n.locale = :en |
1780 | 1761 | end |
1781 | 1762 |
|
1782 | 1763 | let(:plucked) do |
|
1792 | 1773 | end |
1793 | 1774 |
|
1794 | 1775 | context "when the localized field is embedded" do |
| 1776 | + with_default_i18n_configs |
| 1777 | + |
1795 | 1778 | before do |
1796 | 1779 | p = Passport.new |
1797 | 1780 | I18n.locale = :en |
|
1802 | 1785 | Person.create!(passport: p, employer_id: 12345) |
1803 | 1786 | end |
1804 | 1787 |
|
1805 | | - after do |
1806 | | - I18n.locale = :en |
1807 | | - end |
1808 | | - |
1809 | 1788 | let(:plucked) do |
1810 | 1789 | Person.where(employer_id: 12345).pluck("pass.name").first |
1811 | 1790 | end |
|
2045 | 2024 | end |
2046 | 2025 |
|
2047 | 2026 | context "when tallying a localized field" do |
| 2027 | + with_default_i18n_configs |
| 2028 | + |
2048 | 2029 | let(:d1) { Dictionary.new(description: 'en1') } |
2049 | 2030 | let(:d2) { Dictionary.new(description: 'en1') } |
2050 | 2031 | let(:d3) { Dictionary.new(description: 'en1') } |
|
2106 | 2087 | end |
2107 | 2088 |
|
2108 | 2089 | context "when tallying an embedded localized field" do |
| 2090 | + with_default_i18n_configs |
2109 | 2091 |
|
2110 | 2092 | let(:person1) { Person.create!(addresses: [ address1a, address1b ]) } |
2111 | 2093 | let(:person2) { Person.create!(addresses: [ address2a, address2b ]) } |
|
0 commit comments