Sha256: 6ab664602a47c7f834081be47ace8dc32c12ce31f30185eeaacb5c6f90261145

Contents?: true

Size: 916 Bytes

Versions: 12

Compression:

Stored size: 916 Bytes

Contents

require 'spec_helper'

describe BBCoder::Buffer do

  context "#push" do
    it "should append content onto the current depth without increasing depth" do
      subject.push("content")
      subject.push(" + more")
      subject.pop.should == "content + more"
    end
  end

  context "#pop" do
    it "should delete the current depth but not modify the depth" do
      subject.push("content")
      subject.pop
      subject.pop.should == nil
    end
  end

  context "#join" do
    it "should push remaining tags" do
      mock(subject).tags.stub!.join {"joined"}
      mock(subject).push(is_a(String))

      subject.join
    end

    it "should return a string from unopened tags" do
      subject.tags.push("p")
      subject.join.should == "[p]"
    end
  end

  context "#depth" do
    it "should delegate to tags" do
      mock(subject).tags.stub!.size {0}
      subject.depth.should == 0
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bbcoder-1.1.1 spec/buffer_spec.rb
bbcoder-1.1.0 spec/buffer_spec.rb
bbcoder-1.0.1 spec/buffer_spec.rb
bbcoder-1.0.0 spec/buffer_spec.rb
bbcoder-0.2.0 spec/buffer_spec.rb
bbcoder-0.1.6 spec/buffer_spec.rb
bbcoder-0.1.5 spec/buffer_spec.rb
bbcoder-0.1.4 spec/buffer_spec.rb
bbcoder-0.1.3 spec/buffer_spec.rb
bbcoder-0.1.2 spec/buffer_spec.rb
bbcoder-0.1.1 spec/buffer_spec.rb
bbcoder-0.1.0 spec/buffer_spec.rb