Sha256: 03659053bc98e47627351fa760499e29c659f024d23b1ecdf2e9c10db4c9c8f5

Contents?: true

Size: 875 Bytes

Versions: 6

Compression:

Stored size: 875 Bytes

Contents

# coding: utf-8
require 'spec_helper'

describe Arbre::Context do

  setup_arbre_context!

  before do
    h1 "札幌市北区" # Add some HTML to the context
  end

  it "should not increment the indent_level" do
    current_dom_context.indent_level.should == -1
  end

  it "should return a bytesize" do
    current_dom_context.bytesize.should == 25
  end

  it "should return a length" do
    current_dom_context.length.should == 25
  end

  it "should delegate missing methods to the html string" do
    current_dom_context.should respond_to(:index)
    current_dom_context.index('<').should == 0
  end

  it "should use a cached version of the HTML for method delegation" do
    current_dom_context.should_receive(:to_s).once.and_return("<h1>札幌市北区</h1>")
    current_dom_context.index('<').should == 0
    current_dom_context.index('<').should == 0
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
activeadmin-0.4.4 spec/unit/arbre/context_spec.rb
activeadmin-0.4.3 spec/unit/arbre/context_spec.rb
activeadmin-0.4.2 spec/unit/arbre/context_spec.rb
activeadmin-0.4.1 spec/unit/arbre/context_spec.rb
activeadmin-0.4.0 spec/unit/arbre/context_spec.rb
andrewroth_activeadmin-0.3.4.4 spec/unit/arbre/context_spec.rb