# frozen_string_literal: true class TimeagoStub include Rails::Timeago::Helper I18n.backend.store_translations :en, hello: 'World' def time_tag(time, content, options = {}) options = options.map {|k, v| "#{k}=\"#{v}\"" } "" end def time_ago_in_words(_time) '%time_ago_in_words%' end def javascript_tag(source) "" end end class Application attr_accessor :render ASSET_BASE = Pathname.new(File.expand_path('../../..', __FILE__)) ASSET_DIRECTORIES = %w[lib/assets vendor/assets spec/support/assets].freeze def initialize @helper = TimeagoStub.new end def call(env) @request = ::Rack::Request.new(env) if @request.path =~ %r{^/assets/} call_asset else [200, {'Content-Type' => 'text/html'}, [call_render]] end end def call_render body = if @render @render.call(@helper, @request) else '' end <<-HTML