Sha256: e9bab560d5b50e076cd0a561e3184213a30307e62ca1889c56ba59e1951484f3
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
require "reflexive/coderay_html_encoder" describe Reflexive::CodeRayHtmlEncoder do def encoder Reflexive::CodeRayHtmlEncoder.new(:wrap => :div, :css => :style) end it "emits links for :constant tokens" do encoder = Reflexive::CodeRayHtmlEncoder.new(:wrap => :div, :css => :style) encoder.encode_tokens([["Cons", :constant, {:constant_access=>{:name=>"Cons", :scope=>[]}}]]).should(include("<a href")) end it "emits links with proper nesting info" do tokens = [["Cons", :constant, {:constant_access=>{:name=>"Cons", :scope=>["A", "B"]}}]] encoder.encode_tokens(tokens).should include("constant_lookup?name=Cons&scope=A%3A%3AB") end it "emits load_path links" do tokens = [["f", :content, { :load_path => true }]] encoder.encode_tokens(tokens).should include("?path=f") end it "emits class method links" do tokens = [ [ "m!", :ident, {:method_call=>{:name=>"m!", :receiver=>["A"]} } ] ] encoder.encode_tokens(tokens).should include("/constants/A/class_methods/m%21") end it "emits instance method links" do tokens = [ [ "m!", :ident, {:method_call=>{:name=>"m!", :receiver=>["A", :instance]} } ] ] encoder.encode_tokens(tokens).should include("/constants/A/instance_methods/m%21") end it "emits variable assignment id" do tokens = [ [ "a", :ident, {:local_variable_assignment=>"1:a"} ] ] encoder.encode_tokens(tokens).should include("span id='lv:1:a'") end it "emits variable access links" do tokens = [ [ "a", :ident, {:local_variable_access=>"1:a"} ] ] encoder.encode_tokens(tokens).should include("href='#lv:1:a'") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reflexive-0.0.6 | spec/coderay_html_encoder_spec.rb |
reflexive-0.0.5 | spec/coderay_html_encoder_spec.rb |
reflexive-0.0.4 | spec/coderay_html_encoder_spec.rb |