Sha256: 4b14c2ae3cf5eda920359c48699222e65c1a7780cf7ae3a3e4d17a794f6c20dd

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'

module Vedeu

  describe Cursors do

    let(:described) { Vedeu::Cursors }

    it { described.must_respond_to(:cursors) }

    describe '.cursor' do
      subject { Vedeu.cursor }

      context 'when there are cursors are defined' do
        before do
          Vedeu::Focus.add('Vedeu.cursor')
          Vedeu::Cursor.new(name: 'Vedeu.cursor').store
        end

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

      context 'when there are no cursors defined' do
        before do
          Vedeu::Focus.reset
          Vedeu.cursors.reset
        end

        it { subject.must_be_instance_of(NilClass) }
      end
    end

    describe '#by_name' do
      let(:_name) { 'carbon' }

      subject { described.cursors.by_name(_name) }

      context 'when the cursor exists' do
        before { Vedeu::Cursor.new(name: _name).store }
        after { Vedeu.cursors.reset }

        it { subject.must_be_instance_of(Vedeu::Cursor) }
        it { subject.name.must_equal('carbon') }
      end

      context 'when the cursor does not exist' do
        let(:_name) { 'nitrogen' }

        it { subject.must_be_instance_of(Vedeu::Cursor) }
        it { subject.name.must_equal('nitrogen') }
      end
    end

  end # Cursors

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.4.54 test/lib/vedeu/repositories/repositories/cursors_test.rb
vedeu-0.4.53 test/lib/vedeu/repositories/repositories/cursors_test.rb
vedeu-0.4.52 test/lib/vedeu/repositories/repositories/cursors_test.rb
vedeu-0.4.51 test/lib/vedeu/repositories/repositories/cursors_test.rb
vedeu-0.4.50 test/lib/vedeu/repositories/repositories/cursors_test.rb
vedeu-0.4.49 test/lib/vedeu/repositories/repositories/cursors_test.rb
vedeu-0.4.48 test/lib/vedeu/repositories/repositories/cursors_test.rb
vedeu-0.4.47 test/lib/vedeu/repositories/repositories/cursors_test.rb