Sha256: 2e4cf4f5c4a9355c252d2918404bf50e27b7b5e7fb711ffd48f84750e18b1415

Contents?: true

Size: 781 Bytes

Versions: 16

Compression:

Stored size: 781 Bytes

Contents

# encoding: utf-8

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).not_to 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

16 entries across 16 versions & 1 rubygems

Version Path
unparser-0.2.4 spec/unit/unparser/buffer/content_spec.rb
unparser-0.2.3 spec/unit/unparser/buffer/content_spec.rb
unparser-0.2.2 spec/unit/unparser/buffer/content_spec.rb
unparser-0.2.1 spec/unit/unparser/buffer/content_spec.rb
unparser-0.2.0 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.16 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.15 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.14 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.13 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.12 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.11 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.10 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.9 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.8 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.7 spec/unit/unparser/buffer/content_spec.rb
unparser-0.1.6 spec/unit/unparser/buffer/content_spec.rb