Sha256: af322350ec5ab27b3416791d14318bbfaf00a882105a9c706f7adfd616c8082d

Contents?: true

Size: 1.84 KB

Versions: 27

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

require 'test_helper'

module Vedeu

  module Coercers

    describe HorizontalAlignment do

      let(:described) { Vedeu::Coercers::HorizontalAlignment }
      let(:instance)  { described.new(_value) }
      let(:_value)    {}

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

        context 'when the value is valid' do
          let(:_value) { :none }

          it { subject.must_equal(instance) }
        end

        context 'when the value is not valid' do
          let(:_value) { :top }

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

      describe '#value' do
        subject { described.coerce(_value).value }

        context 'when the value is :none' do
          let(:_value) { :none }

          it { subject.must_equal(:none) }
        end

        context 'when the value is nil' do
          it { subject.must_equal(:none) }
        end

        context 'when the value is not a Symbol' do
          let(:_value) { 'invalid' }

          it { subject.must_equal(:none) }
        end

        context 'when the value is :center' do
          let(:_value) { :center }

          it { subject.must_equal(:centre) }
        end

        context 'when the value is :centre' do
          let(:_value) { :centre }

          it { subject.must_equal(:centre) }
        end

        context 'when the value is :left' do
          let(:_value) { :left }

          it { subject.must_equal(:left) }
        end

        context 'when the value is :right' do
          let(:_value) { :right }

          it { subject.must_equal(:right) }
        end

        context 'when the value is :align_invalid' do
          let(:_value) { :align_invalid }

          it { subject.must_equal(:none) }
        end
      end

    end # HorizontalAlignment

  end # Coercers

end # Vedeu

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
vedeu-0.8.32 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.31 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.30 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.29 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.28 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.27 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.26 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.25 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.24 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.23 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.22 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.21 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.20 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.19 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.18 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.17 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.16 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.15 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.14 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.13 test/lib/vedeu/coercers/horizontal_alignment_test.rb