Sha256: d43feea851c64e4051b6ee4d3274cff44ff0b42ede6ff8c48191d5da8ebb7b04

Contents?: true

Size: 1.95 KB

Versions: 6

Compression:

Stored size: 1.95 KB

Contents

require 'test_helper'

module Vedeu

  class DummyRenderer
    def self.render
      :dummy
    end
  end

  class FooRenderer
    def self.render
      :foo
    end
  end

  describe Renderers do

    let(:described) { Vedeu::Renderers }

    before { Vedeu::Renderers.reset }
    after  { Vedeu::Renderers.reset }

    describe '.renderers' do
      subject { described.renderers }

      it { subject.must_be_instance_of(Module) }

      # context 'API' do
      #   before { Vedeu::Renderers.renderer(*renderers) }

      #   subject { Vedeu.renderers.render }

      #   context 'when a single renderer is defined' do
      #     let(:renderers) { DummyRenderer }

      #     it { subject.must_equal([:dummy]) }
      #   end

      #   context 'when multiple renderers are defined' do
      #     let(:renderers) { [DummyRenderer, FooRenderer] }

      #     it { subject.must_equal([:dummy, :foo]) }
      #   end

      #   context 'when no renderers are defined' do
      #     let(:renderers) {}

      #     it { subject.must_equal([]) }
      #   end
      # end
    end

    describe '.renderer' do
      let(:renderers) {}

      subject { described.renderer(*renderers) }

      it { subject.must_be_instance_of(Set) }

      context 'with a single renderer' do
        let(:renderers) { DummyRenderer }

        it { subject.size.must_equal(1) }
      end

      context 'with multiple renderers' do
        let(:renderers) { [DummyRenderer, FooRenderer] }

        it { subject.size.must_equal(2) }
      end

      context 'with no renderer' do
        let(:renderers) {}

        it { subject.size.must_equal(0) }
      end
    end

    describe '.reset' do
      subject { described.reset }

      it { subject.must_be_instance_of(Set) }
      it { subject.size.must_equal(0) }
    end

    describe '.storage' do
      subject { described.storage }

      it { subject.must_be_instance_of(Set) }
      it { subject.size.must_equal(0) }
    end

  end # Renderers

end # Vedeu

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.4.19 test/lib/vedeu/output/renderers/all_test.rb
vedeu-0.4.18 test/lib/vedeu/output/renderers/all_test.rb
vedeu-0.4.17 test/lib/vedeu/output/renderers/all_test.rb
vedeu-0.4.16 test/lib/vedeu/output/renderers/all_test.rb
vedeu-0.4.15 test/lib/vedeu/output/renderers/all_test.rb
vedeu-0.4.14 test/lib/vedeu/output/renderers/all_test.rb