Sha256: 2132ca77b8700ac02478d8e10d3625ce1d39b89f4943874fc6c55fec3170cba2

Contents?: true

Size: 1.72 KB

Versions: 4

Compression:

Stored size: 1.72 KB

Contents

require 'test_helper'

module Vedeu

  describe HTMLRenderer do

    let(:described) { Vedeu::HTMLRenderer }
    let(:instance)  { described.new(output) }
    let(:output)    {}

    describe '#initialize' do
      it { instance.must_be_instance_of(Vedeu::HTMLRenderer) }
      it { instance.instance_variable_get('@output').must_equal(output) }
    end

    describe '#render' do
      subject { instance.render }

      it { subject.must_be_instance_of(String) }
    end

    describe '.to_file' do
      before { File.stubs(:open) }

      subject { described.to_file(output, path) }

      context 'when a path is given' do
        let(:path) { '/tmp/test_vedeu_html_renderer.html' }

        #it { subject.must_equal('') }
      end

      context 'when a path is not given' do
        let(:path) {}


      end
    end

    describe '#html_body' do
      subject { instance.html_body }

      it { subject.must_be_instance_of(String) }

      it { subject.must_equal('') }

      context 'when there is output' do
        let(:output) {
          [
            [
              Vedeu::Char.new({ value: 't' }),
              Vedeu::Char.new({ value: 'e' }),
              Vedeu::Char.new({ value: 's' }),
              Vedeu::Char.new({ value: 't' }),
            ]
          ]
        }

        it { subject.must_equal(
          "<tr>\n" \
          "<td style='background:#000;color:#222;border:1px #000 solid;'>t</td>\n" \
          "<td style='background:#000;color:#222;border:1px #000 solid;'>e</td>\n" \
          "<td style='background:#000;color:#222;border:1px #000 solid;'>s</td>\n" \
          "<td style='background:#000;color:#222;border:1px #000 solid;'>t</td>\n" \
          "</tr>\n") }
      end
    end

  end # HTMLRenderer

end # Vedeu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.4.13 test/lib/vedeu/output/renderers/html_renderer_test.rb
vedeu-0.4.12 test/lib/vedeu/output/renderers/html_renderer_test.rb
vedeu-0.4.11 test/lib/vedeu/output/renderers/html_renderer_test.rb
vedeu-0.4.10 test/lib/vedeu/output/renderers/html_renderer_test.rb