}); describe("::titleize()", function () { it("titleizes a string", function () { expect(Inflector::titleize('posts'))->toBe('Posts'); expect(Inflector::titleize('posts_tags'))->toBe('Posts Tags'); expect(Inflector::titleize('file_systems'))->toBe('File Systems'); expect(Inflector::titleize('the-post-title', '-'))->toBe('The Post Title'); }); }); describe("::humanize()", function () { it("humanizes a string", function () { expect(Inflector::humanize('posts'))->toBe('Posts'); expect(Inflector::humanize('post_id'))->toBe('Post'); expect(Inflector::humanize('posts_tags'))->toBe('Posts tags'); expect(Inflector::humanize('file_systems'))->toBe('File systems'); expect(Inflector::humanize('the-post-title', '-'))->toBe('The post title'); }); }); describe("::plural()", function () { beforeEach(function () { Inflector::reset(); }); it("adds a new pluralization rule", function () { Inflector::plural('/(bye)$/i', 'Good \\1'); expect(Inflector::pluralize('bye'))->toBe('Good bye'); }); it("adds a new pluralization rule only in a specified locale", function () { Inflector::plural('/(bye)$/i', 'Good \\1', 'fr'); expect(Inflector::pluralize('bye'))->not->toBe('Good bye'); expect(Inflector::pluralize('bye', 'fr'))->toBe('Good bye'); });