Sha256: 3da4a9a09e38e603eb058f56ef864833a935428eb0eda0c96917bf9e724ca90d
Contents?: true
Size: 1005 Bytes
Versions: 17
Compression:
Stored size: 1005 Bytes
Contents
require 'hamlit' require 'unindent' module HamlitSpecHelper DEFAULT_OPTIONS = { ugly: true, }.freeze def parse_string(str) Hamlit::Parser.new.call(str) end def render_string(str, options = {}) options = DEFAULT_OPTIONS.merge(options) eval Hamlit::Engine.new(options).call(str) end def assert_render(haml, html, options = {}) haml = haml.unindent html = html.unindent expect(render_string(haml, options)).to eq(html) end def assert_parse(haml, &block) haml = haml.unindent ast = block.call expect(parse_string(haml)).to eq(ast) end def assert_compile(before, after) result = described_class.new.call(before) expect(result).to eq(after) end end RSpec.configure do |config| config.include HamlitSpecHelper config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end end
Version data entries
17 entries across 17 versions & 1 rubygems