require 'test_helper' class ActionView::TestCase; include Titlezilla::Helpers::Title; end module Titlezilla module Helpers describe Title do describe 'integration' do before do load_translations({ application: 'App', main: { new: 'New', edit: 'Edit' } }) end it '#title' do @controller.controller_path = :main @controller.action_name = :new title.must_equal 'New' end it '#title using view assigns' do load_translations({ main: { new: 'New: %{name}' } }) @controller.controller_path = :main @controller.action_name = :new @controller.view_assigns = { name: 'John' } title.must_equal 'New: John' end it '#application_title' do @controller.controller_path = :main @controller.action_name = :new application_title.must_equal 'App' end it '#meta_title' do @controller.controller_path = :main @controller.action_name = :new meta_title.must_equal 'New | App' end it 'should render title tag' do @controller.controller_path = :main @controller.action_name = :new title_tag.must_equal '