Sha256: 94e59e6742b8e427716cc434fa075c95e1e705624ebed7ea93003cd22e10dec6

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'test_helper'

module Vedeu
  describe Cursors do

    before do
      Cursors.reset
      Registrar.record({ name: 'chromium' })
    end

    describe '#add' do
      let(:attributes) { { name: 'chromium' } }

      it 'returns a new Cursor after registering' do
        Cursors.add(attributes).must_be_instance_of(Cursor)
      end

      it 'returns a new Cursor after updating' do
        Cursors.update(attributes).must_be_instance_of(Cursor)
      end

      context 'when the attributes do not have the :name key' do
        let(:attributes) { { no_name_key: 'some_value' } }

        it 'raises an exception' do
          proc { Cursors.update(attributes) }.must_raise(MissingRequired)
        end

        it 'raises an exception' do
          proc { Cursors.add(attributes) }.must_raise(MissingRequired)
        end
      end
    end

    describe '#hide' do
      it 'sets the state attribute of the Cursor to :hide' do
        cursor = Cursors.hide
        cursor.state.must_equal(:hide)
      end
    end

    describe '#show' do
      it 'sets the state attribute of the Cursor to :show' do
        cursor = Cursors.show
        cursor.state.must_equal(:show)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.2.4 test/lib/vedeu/repositories/cursors_test.rb