Sha256: 2f0752bbcbbeac4fca21fb450e3ce7994fafa6859f1f6498f63b41156c45e239

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

require 'test_helper'

module Vedeu

  module Output

    describe Viewport do

      let(:described)  { Vedeu::Output::Viewport }
      let(:instance)   { described.new(view) }
      let(:view)       {
        Vedeu::Views::View.build(name: 'lithium', style: nil) do
          lines do
            line 'barium'
            line 'carbon'
            line 'helium'
            line 'iodine'
            line 'nickel'
            line 'osmium'
          end
        end
      }
      let(:visible)   { true }
      let(:interface) {
        Vedeu::Models::Interface.new(style: nil, visible: visible)
      }
      let(:geometry)  { Vedeu::Geometry::Geometry.new(height: 3, width: 3) }

      before do
        Vedeu.interfaces.stubs(:by_name).returns(interface)
        Vedeu.geometries.stubs(:by_name).returns(geometry)
      end
      after { Vedeu.interfaces.reset }

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@view').must_equal(view) }
      end

      describe '.render' do
        before do
          Vedeu::Output::Output.stubs(:render)
        end

        subject { described.render(view) }

        context 'when the interface is visible' do
          it {
            Vedeu::Output::Output.expects(:render)
            subject
          }
        end

        context 'when the interface is not visible' do
          let(:visible) { false }

          it { subject.must_equal(nil) }
        end
      end

      describe '#render' do
        it { instance.must_respond_to(:render) }
      end

      describe '#to_s' do
        it { instance.must_respond_to(:to_s) }
      end

    end # Viewport

  end # Output

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.6.22 test/lib/vedeu/output/viewport_test.rb