Sha256: 8a324b9618fcb2be9147f7aecac4ab7b0d425128193921b75883b6732540dc83

Contents?: true

Size: 1.95 KB

Versions: 30

Compression:

Stored size: 1.95 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::Interfaces::Interface.new(style: nil, visible: visible)
      }
      let(:geometry)  { Vedeu::Geometry::Geometry.new(height: 3, width: 3) }
      let(:ready)     { true }

      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.stubs(:render_output)
          Vedeu.stubs(:ready?).returns(ready)
        end

        subject { described.render(view) }

        context 'when the interface is visible' do
          context 'and Vedeu is ready' do
            it {
              Vedeu.expects(:render_output)
              subject
            }
          end

          context 'but Vedeu is not ready' do
            let(:ready) { false }

            it { subject.must_equal(nil) }
          end
        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

30 entries across 30 versions & 1 rubygems

Version Path
vedeu-0.6.59 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.58 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.57 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.56 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.54 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.53 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.52 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.51 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.50 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.49 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.48 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.47 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.46 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.45 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.44 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.43 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.42 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.41 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.40 test/lib/vedeu/output/viewport_test.rb
vedeu-0.6.39 test/lib/vedeu/output/viewport_test.rb