Sha256: e5f658e268d79b748b43b935e79d3e6ef7f6ab0e4c689745a8a55ed2d2b259b1

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

require 'test_helper'

module Vedeu

  module Views

    describe Chars do

      let(:described)  { Vedeu::Views::Chars }
      let(:instance)   { described.new(collection, parent, _name) }
      let(:collection) { [] }
      let(:parent)     { Vedeu::Views::Stream.new(parent_attributes) }
      let(:_name)      { :vedeu_views_chars }

      let(:parent_attributes) {
        {

        }
      }

      describe '.coerce' do
        subject { described.coerce(collection, parent, _name) }

        context 'when the collection is a Vedeu::Views::Chars' do
          let(:expected) { described.new(collection, parent, _name) }

          it { subject.must_equal(expected) }
        end

        context 'when the collection is an Array' do
          context 'when the collection is empty' do
            let(:collection) { [] }
            let(:expected)   { described.new(collection, parent) }

            it { subject.must_equal(expected) }
          end

          context 'when the collection is not empty' do
            # @todo Add more tests.
          end
        end

        context 'when the collection is a Vedeu::Views::Stream' do
          # @todo Add more tests.
        end

        context 'when the collection is a String' do
          context 'when the collection is empty' do
            let(:collection) { '' }
            let(:expected)   { described.new([], parent) }

            it { subject.must_equal(expected) }
          end

          context 'when the collection is not empty' do
            # @todo Add more tests.
          end
        end

        context 'when the collection is something else' do
          let(:collection) { :invalid }

          it { proc { subject }.must_raise(Vedeu::Error::InvalidSyntax) }
        end
      end

    end # Chars

  end # Views

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.8.2 test/lib/vedeu/views/chars_test.rb
vedeu-0.8.1 test/lib/vedeu/views/chars_test.rb