# frozen_string_literal: true require 'intranet/abstract_responder' module Intranet class TestResponder < AbstractResponder attr_reader :finalized def initialize(responses = {}, extra_css = [], extra_js = []) @responses = responses @extra_css = extra_css @extra_js = extra_js @finalized = false end def finalize @finalized = true super end def self.module_name 'test-responder' end def self.module_version '0.0.0' end def self.module_homepage 'http://nil/' end def resources_dir __dir__ end def generate_page(path, query) if path == '/query' [200, 'text/plain', query.to_s + "\r\n"] else @responses.fetch(path) end rescue KeyError super(path, query) end def css_dependencies super + @extra_css end def js_dependencies super + @extra_js end end end