Sha256: a0fab7490c7f967ebb1f83111d3093cb01fc558f89777bd0a08728dc42e6cbee

Contents?: true

Size: 1.65 KB

Versions: 17

Compression:

Stored size: 1.65 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 Style 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::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::Style.new('normal') }

        subject { includer.style = (style) }

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

    end # Style

  end # Presentation

end # Vedeu

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
vedeu-0.6.8 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.7 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.6 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.5 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.4 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.3 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.2 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.1 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.6.0 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.13 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.12 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.11 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.10 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.9 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.8 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.7 test/lib/vedeu/output/presentation/style_test.rb
vedeu-0.5.6 test/lib/vedeu/output/presentation/style_test.rb