Sha256: 9fe9ba8fd72698a6167c879c1e1a2e2a9f4dd78eca7f51e2a346ec5970417ebe

Contents?: true

Size: 1.87 KB

Versions: 8

Compression:

Stored size: 1.87 KB

Contents

require 'test_helper'

module Vedeu

  module DSL

    describe Presentation do

      let(:described)  { Vedeu::DSL::Presentation }
      let(:instance)   { Vedeu::DSL::Interface.new(model) }
      let(:model)      { Vedeu::Interface.new }
      let(:background) { '#00ff00' }
      let(:foreground) { '#ff00ff' }

      describe '#background' do
        subject { instance.background(background) }

        it { instance.must_respond_to(:bg) }
        it { instance.must_respond_to(:bgcolor) }

        it { subject.must_be_instance_of(Vedeu::Colour) }

        it 'sets the background' do
          subject.attributes.must_equal(
            background: '#00ff00', foreground: ''
          )
        end
      end

      describe '#foreground' do
        subject { instance.foreground(foreground) }

        it { instance.must_respond_to(:fg) }
        it { instance.must_respond_to(:fgcolor) }

        it { subject.must_be_instance_of(Vedeu::Colour) }

        it 'sets the foreground' do
          subject.attributes.must_equal(
            background: '', foreground: '#ff00ff'
          )
        end
      end

      describe '#colour' do
        let(:attributes) { { background: background, foreground: foreground } }

        subject { instance.colour(attributes) }

        it { subject.must_be_instance_of(Vedeu::Colour) }

        context 'with an empty value' do
          let(:attributes) { { background: background, foreground: '' } }

          it 'sets only the valid attributes' do
            subject.attributes.must_equal(
              background: '#00ff00', foreground: ''
            )
          end
        end
      end

      describe '#style' do
        let(:args)  { :bold }

        subject { instance.style(args) }

        it { instance.must_respond_to(:styles) }

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

    end # Presentation

  end # DSL

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.4.41 test/lib/vedeu/dsl/presentation_test.rb
vedeu-0.4.40 test/lib/vedeu/dsl/presentation_test.rb
vedeu-0.4.39 test/lib/vedeu/dsl/presentation_test.rb
vedeu-0.4.38 test/lib/vedeu/dsl/presentation_test.rb
vedeu-0.4.37 test/lib/vedeu/dsl/presentation_test.rb
vedeu-0.4.36 test/lib/vedeu/dsl/presentation_test.rb
vedeu-0.4.35 test/lib/vedeu/dsl/presentation_test.rb
vedeu-0.4.34 test/lib/vedeu/dsl/presentation_test.rb