Sha256: ea17ebd7dead129b9674ae408dcc1e067335b3b8c3dbee9ebe663836ad188292

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 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 '#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

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.8.4 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.3 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.2 test/lib/vedeu/coercers/horizontal_alignment_test.rb
vedeu-0.8.1 test/lib/vedeu/coercers/horizontal_alignment_test.rb