Sha256: dd05dfa3a7352df7a485fd2a67161dbe08a0505cffc0c8d64006f0f3a0fcf590
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
require 'spec_helper' module Deface describe Parser do describe "#convert_fragment" do it "should parse html" do Deface::Parser.convert_fragment("<h1>Hello</h1>").to_s.should == "<h1>Hello</h1>" end it "should convert <% ... %>" do Deface::Parser.convert_fragment("<% method_name %>").to_s.should == "<code erb-silent> method_name </code>" end it "should convert <%= ... %>" do Deface::Parser.convert_fragment("<%= method_name %>").to_s.should == "<code erb-loud> method_name </code>" end it "should convert nested <% ... %>" do Deface::Parser.convert_fragment("<p id=\"<% method_name %>\"></p>").to_s.should == "<p id=\"<code erb-silent> method_name </code>\"></p>" end it "should convert nested <%= ... %>" do Deface::Parser.convert_fragment("<p id=\"<%= method_name %>\"></p>").to_s.should == "<p id=\"<code erb-loud> method_name </code>\"></p>" end end describe "#undo_erb_markup" do it "should revert <code erb-silent>" do Deface::Parser.undo_erb_markup!("<code erb-silent> method_name </code>").should == "<% method_name %>" end it "should revert <code erb-loud>" do Deface::Parser.undo_erb_markup!("<code erb-loud> method_name </code>").should == "<%= method_name %>" end it "should revert nested <code erb-silent>" do Deface::Parser.undo_erb_markup!("<p id=\"<code erb-silent> method_name > 1 </code>\"></p>").should == "<p id=\"<% method_name > 1 %>\"></p>" end it "should revert nested <code erb-loud>" do Deface::Parser.undo_erb_markup!("<p id=\"<code erb-loud> method_name < 2 </code>\"></p>").should == "<p id=\"<%= method_name < 2 %>\"></p>" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deface-0.2.0 | spec/deface/parser_spec.rb |