Sha256: fcd427e0d8598e4cb03b204fc9e5829a2c82374b0890fbb071372e641f3d2bab

Contents?: true

Size: 836 Bytes

Versions: 6

Compression:

Stored size: 836 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
    expect(context.indent_level).to eq(-1)
  end

  it "should return a bytesize" do
    expect(context.bytesize).to eq(25)
  end

  it "should return a length" do
    expect(context.length).to eq(25)
  end

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

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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arbre-1.2.1 spec/arbre/unit/context_spec.rb
arbre-1.2.0 spec/arbre/unit/context_spec.rb
arbre-1.2.0.rc1 spec/arbre/unit/context_spec.rb
arbre-1.1.1 spec/arbre/unit/context_spec.rb
arbre-1.0.3 spec/arbre/unit/context_spec.rb
arbre-1.0.2 spec/arbre/unit/context_spec.rb