Sha256: 7bad6d055eef98a25a3dc4541c32c255bf73af687cf6bd5e0f922576cdcd8cc3

Contents?: true

Size: 1.08 KB

Versions: 25

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

module Vedeu

  module Templating

    describe Preprocessor do

      let(:described) { Vedeu::Templating::Preprocessor }
      let(:instance)  { described.new(lines) }
      let(:lines)     {
        [
          "Some text here\n",
          "{{ colour(foreground: '#0f0') { 'Yay!' } }}\n",
          "More text here\n"
        ]
      }

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@lines').must_equal(lines) }
      end

      describe '.process' do
        it { described.must_respond_to(:process) }
      end

      describe '#process' do
        let(:expected) {
          [
            Vedeu::Stream.new(value: 'Some text here'),
            Vedeu::Stream.new(value: 'Yay!',
                              colour: Vedeu::Colour.coerce({ foreground: '#0f0' })),
            Vedeu::Stream.new(value: 'More text here')
          ]
        }

        subject { instance.process }

        it { subject.must_equal(expected) }
      end

    end # Preprocessor

  end # Templating

end # Vedeu

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
vedeu-0.4.52 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.51 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.50 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.49 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.48 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.47 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.46 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.45 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.44 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.43 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.42 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.41 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.40 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.39 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.38 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.37 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.36 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.35 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.34 test/lib/vedeu/templating/preprocessor_test.rb
vedeu-0.4.33 test/lib/vedeu/templating/preprocessor_test.rb