I have an assistant page_title_defaultin ApplicationHelper:
def page_title_default(options = {})
t '.title', options
end
Now I want to test it as follows:
describe '#page_title' do
subject { page_title }
it { ... }
end
end
This results in the following error:
Cannot use t(".title") shortcut because path is not available
According to this post, it should be possible to drown out the variable @virtual_pathas follows:
helper.instance_variable_set(:@virtual_path, "admin.path.form")
But this does not help: although I can drown it out and then call something like helper.t '.something'directly in the test, this does not work for the translation helper, which is used in the page_title_defaultmethod (which still has @virtual_pathit set to nil). So this is not the same instance of the translation assistant. But how can I find a method page_title_default?