Sha256: 947c841c4bddcdd047771a4931d88b582e7b3767e969ca6a26690694fe96eebf

Contents?: true

Size: 813 Bytes

Versions: 8

Compression:

Stored size: 813 Bytes

Contents

require_relative "spec_helper"

require "cute_print/inline_labeler"

module CutePrint
  describe InlineLabeler do

    let(:label) { "foo.rb:1: " }
    let(:value) { [1, 2, 3, 4, 5] }
    subject { InlineLabeler.label(formatter, width, label, value) }

    context "single line" do
      let(:formatter) { Format::Inspect.new }
      let(:width) { 80 }
      specify do
        expect(subject).to eq [
          "foo.rb:1:\n",
          "  [1, 2, 3, 4, 5]\n",
        ]
      end
    end

    context "multiple lines" do
      let(:formatter) { Format::PrettyPrint.new }
      let(:width) { 4 }
      specify do
        expect(subject).to eq [
          "foo.rb:1:\n",
          "  [1,\n",
          "   2,\n",
          "   3,\n",
          "   4,\n",
          "   5]\n",
        ]
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cute_print-1.1.4 spec/inline_labeler_spec.rb
cute_print-1.1.3 spec/inline_labeler_spec.rb
cute_print-1.1.2 spec/inline_labeler_spec.rb
cute_print-1.1.1 spec/inline_labeler_spec.rb
cute_print-1.1.0 spec/inline_labeler_spec.rb
cute_print-1.0.1 spec/inline_labeler_spec.rb
cute_print-1.0.0 spec/inline_labeler_spec.rb
cute_print-0.4.0 spec/inline_labeler_spec.rb