Sha256: 408555cdea5e6273f2aa4a85369aa3f14682c1ad626a77718f9c3b0ae3f2f5a4

Contents?: true

Size: 762 Bytes

Versions: 22

Compression:

Stored size: 762 Bytes

Contents

require 'spec_helper'

describe Unparser::Buffer, '#content' do
  subject { object.content }

  let(:object) { described_class.new }

  shared_examples_for 'buffer content' do
    it 'contains expected content' do
      should eql(expected_content)
    end

    it { should be_frozen }

    it 'returns fresh string copies' do
      first  = object.content
      second = object.content
      expect(first).to eql(second)
      expect(first).to_not be(second)
    end
  end

  context 'with empty buffer' do
    let(:expected_content) { '' }

    it_should_behave_like 'buffer content'
  end

  context 'with filled buffer' do
    before do
      object.append('foo')
    end

    let(:expected_content) { 'foo' }

    it_behaves_like 'buffer content'
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
unparser-0.1.5 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.4 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.3 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.2 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.1 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.0 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.18 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.16 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.15 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.14 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.13 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.12 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.11 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.10 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.8 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.7 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.6 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.5 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.4 spec/unit/unparser/buffer/content_spec.rb
unparser-0.0.3 spec/unit/unparser/buffer/content_spec.rb