Sha256: 36ca271de0afca12938f230e20bdc696faa33a45ef583e23a463ab269f7cb379

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

# coding: utf-8
require 'spec_helper'

describe Arbo::Context do

  let(:context) do
    Arbo::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(:render_in).once.and_return("<h1>札幌市北区</h1>")
    expect(context.index('<')).to eq(0)
    expect(context.index('<')).to eq(0)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arbo-1.3.1 spec/arbo/unit/context_spec.rb
arbo-1.3.0 spec/arbo/unit/context_spec.rb
arbo-1.2.0 spec/arbo/unit/context_spec.rb