Sha256: 352ff6a852386ec36fd097bc33668494d041a5108a03c0bf82b60dae580801fe

Contents?: true

Size: 1.69 KB

Versions: 22

Compression:

Stored size: 1.69 KB

Contents

require 'test_helper'

module Vedeu

  class ParentPresentationStyleTestClass

    include Vedeu::Presentation

    attr_reader :attributes
    attr_reader :parent

    def attributes
      {
        style: ['underline']
      }
    end

  end

  class PresentationStyleTestClass

    include Vedeu::Presentation

    attr_reader :attributes
    attr_reader :parent

    def initialize(attributes = {})
      @attributes = attributes
      @parent     = @attributes[:parent]
    end

  end # PresentationTestClass

  module Presentation

    describe Styles do

      let(:includer) { Vedeu::PresentationStyleTestClass.new(attributes) }
      let(:attributes) {
        {
          parent: parent,
          style:  style,
        }
      }
      let(:parent) { Vedeu::ParentPresentationStyleTestClass.new }
      let(:style)  { ['bold'] }

      describe '#style' do
        subject { includer.style }

        it { subject.must_be_instance_of(Vedeu::Presentation::Style) }

        context 'when the attribute is not set' do
          let(:style) {}

          context 'when a parent is available' do
            it { subject.value.must_equal(['underline']) }
          end

          context 'when a parent is not available' do
            let(:parent) {}

            it { subject.value.must_equal(nil) }
          end
        end

        context 'when the attribute is set' do
          it { subject.value.must_equal(['bold']) }
        end
      end

      describe '#style=' do
        let(:style) { Vedeu::Presentation::Style.new('normal') }

        subject { includer.style = (style) }

        it { subject.must_be_instance_of(Vedeu::Presentation::Style) }
      end

    end # Style

  end # Presentation

end # Vedeu

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
vedeu-0.6.30 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.29 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.28 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.27 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.26 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.25 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.24 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.23 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.22 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.21 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.20 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.19 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.18 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.17 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.16 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.15 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.14 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.13 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.12 test/lib/vedeu/output/presentation/styles_test.rb
vedeu-0.6.11 test/lib/vedeu/output/presentation/styles_test.rb