Sha256: f4fe81d04cc46a06b8e5c8000f8f175b00caffb463dd1903d3759fb7ccda83d8
Contents?: true
Size: 995 Bytes
Versions: 2
Compression:
Stored size: 995 Bytes
Contents
require 'minitest/autorun' require 'minitest/reporters' require 'rack/test' require 'coderay' require 'pygments' require 'rouge' require 'uv' require File.expand_path('../../lib/rack/highlighter', __FILE__) include Rack::Test::Methods MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new def create_app(status, headers, content, highlighter, options) app = lambda { |env| [status, headers, [content]] } Rack::Highlighter.new(app, highlighter, options) end def generate_example(args) elements = args[:elements].clone attribute = args[:attribute] value = args[:value] content = args[:content] doc = Nokogiri::HTML::DocumentFragment.parse('') current = doc until elements.empty? tmp = Nokogiri::XML::Node.new(elements.shift, doc) if elements.empty? tmp[attribute] = value tmp.content = content end current << tmp current = tmp end doc.to_html end def generate_example_with(klass, content, &block) doc.to_html end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-highlighter-0.2.1 | spec/spec_helper.rb |
rack-highlighter-0.2.0 | spec/spec_helper.rb |