Sha256: 2f68ffb648eb2c7541f5a4a6b71d6e4c290600e1596959fd1fe7874b9cbc4f90

Contents?: true

Size: 1.67 KB

Versions: 8

Compression:

Stored size: 1.67 KB

Contents

require 'test_helper'

module Vedeu

  class ParentPresentationStyleTestClass

    include Vedeu::Presentation

    attr_reader :style

    def initialize
      @style  = ['underline']
      @parent = nil
    end

  end # ParentPresentationStyleTestClass

  class PresentationStyleTestClass

    include Vedeu::Presentation

    attr_reader :parent

    def initialize(attributes = {})
      @style  = attributes[:style]
      @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

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.8.0 test/lib/vedeu/presentation/styles_test.rb
vedeu-0.7.4 test/lib/vedeu/presentation/styles_test.rb
vedeu-0.7.3 test/lib/vedeu/presentation/styles_test.rb
vedeu-0.7.2 test/lib/vedeu/presentation/styles_test.rb
vedeu-0.7.1 test/lib/vedeu/presentation/styles_test.rb
vedeu-0.7.0 test/lib/vedeu/presentation/styles_test.rb
vedeu-0.6.71 test/lib/vedeu/presentation/styles_test.rb
vedeu-0.6.70 test/lib/vedeu/presentation/styles_test.rb