Sha256: ff1860733cd18e179e8ed1ca77e32b3a982c8d2ffe0950d90a10fea6dc57a839
Contents?: true
Size: 972 Bytes
Versions: 29
Compression:
Stored size: 972 Bytes
Contents
require 'hashery' require 'awestruct/handlers/string_handler' require 'awestruct/handlers/interpolation_handler' describe Awestruct::Handlers::InterpolationHandler do before :all do @site = Hashery::OpenCascade[ { encoding: false, interpolate: true } ] end it "should interpolate content when rendered" do handler = build_handler( 'This is #{cheese}' ) context = Hashery::OpenCascade[ { :cheese=>'swiss' } ] content = handler.rendered_content( context ) content.should == 'This is swiss' end it "should correctly interpolate complicated stuff that includes regular expressions [Issue #139]" do input = %q(url = url.replace(/\/?#$/, '');) handler = build_handler( input ) content = handler.rendered_content( Hashery::OpenCascade[] ) content.should == input end def build_handler( input ) Awestruct::Handlers::InterpolationHandler.new( @site, Awestruct::Handlers::StringHandler.new( @site, input ) ) end end
Version data entries
29 entries across 29 versions & 1 rubygems