Sha256: 5c9f32c07507fa1882420a07e38b4b0fa15c99cebc4d4dfa1c40287c786c03e1

Contents?: true

Size: 1.89 KB

Versions: 5

Compression:

Stored size: 1.89 KB

Contents

require 'test_helper'

module Vedeu

  describe Registrar do

    before do
      Buffers.reset
      Interfaces.reset
      Groups.reset
      Focus.reset
    end

    describe '.record' do
      let(:attributes) {
        {
          name:  'mendelevium',
          group: 'elements'
        }
      }

      it 'raises an exception if the attributes does not have a :name key' do
        attributes = { no_name_key: '' }

        proc { Registrar.record(attributes) }.must_raise(MissingRequired)
      end

      it 'raises an exception if the value for :name is nil' do
        attributes = { name: nil }

        proc { Registrar.record(attributes) }.must_raise(MissingRequired)
      end

      it 'raises an exception if the value for :name is empty' do
        attributes = { name: '' }

        proc { Registrar.record(attributes) }.must_raise(MissingRequired)
      end

      it 'sends the attributes to the Buffers repository' do
        Registrar.record(attributes)

        Buffers.registered?('mendelevium').must_equal(true)
      end

      it 'sends the attributes to the Offsets repository' do
        Registrar.record(attributes)

        Offsets.registered?('mendelevium').must_equal(true)
      end

      it 'sends the attributes to the Interfaces repository' do
        Registrar.record(attributes)

        Interfaces.registered?('mendelevium').must_equal(true)
      end

      it 'sends the attributes to the Cursors repository' do
        Registrar.record(attributes)

        Cursors.registered?('mendelevium').must_equal(true)
      end

      it 'sends the attributes to the Groups repository' do
        Registrar.record(attributes)

        Groups.registered?('elements').must_equal(true)
      end

      it 'sends the attributes to the Focus repository' do
        Registrar.record(attributes)

        Focus.registered?('mendelevium').must_equal(true)
      end

    end

  end # Registrar

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.2.9 test/lib/vedeu/support/registrar_test.rb
vedeu-0.2.8 test/lib/vedeu/support/registrar_test.rb
vedeu-0.2.7 test/lib/vedeu/support/registrar_test.rb
vedeu-0.2.6 test/lib/vedeu/support/registrar_test.rb
vedeu-0.2.5 test/lib/vedeu/support/registrar_test.rb