Sha256: ce07634de1bbddf131b78cd7f1ff79f766ef167e39b2a5860c6219e7f5cf48a3

Contents?: true

Size: 798 Bytes

Versions: 6

Compression:

Stored size: 798 Bytes

Contents

# coding: utf-8
require 'spec_helper'

describe Arbre::Context do

  let(:context) do
    Arbre::Context.new do
      h1 "札幌市北区" # Add some HTML to the context
    end
  end

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

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

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

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

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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arbre-1.0.1 spec/arbre/unit/context_spec.rb
arbre-1.0.0 spec/arbre/unit/context_spec.rb
arbre-1.0.0.rc4 spec/arbre/unit/context_spec.rb
arbre-1.0.0.rc3 spec/arbre/unit/context_spec.rb
arbre-1.0.0.rc2 spec/arbre/unit/context_spec.rb
arbre-1.0.0.rc1 spec/arbre/unit/context_spec.rb