Sha256: 3462a5b64e4f233574cb11407f76488bbce65aac9873070300db73f04025bcf1

Contents?: true

Size: 1.91 KB

Versions: 8

Compression:

Stored size: 1.91 KB

Contents

require 'test_helper'

module Vedeu

  module API

    describe Defined do

      describe '#events' do
        it 'returns all events currently registered' do
          Vedeu.event(:birthday) { :eat_too_much_cake }

          Defined.events.must_include(:birthday)
        end
      end

      describe '#groups' do
        before { Vedeu::Groups.reset }

        it 'returns no groups when none currently registered' do
          Defined.groups.must_equal([])
        end

        it 'returns all groups currently registered' do
          Vedeu.interface('hydrogen') { group 'elements' }

          Defined.groups.must_equal(['elements'])
        end
      end

      describe '#interfaces' do
        before { Vedeu::Interfaces.reset }

        it 'returns no interfaces when none currently registered' do
          Defined.interfaces.must_equal([])
        end

        it 'returns all interfaces currently registered' do
          Vedeu.interface('hydrogen') { group 'elements' }

          Defined.interfaces.must_equal(['hydrogen'])
        end
      end

      describe '#keymaps' do
        before { Vedeu::Keymaps.reset }

        it 'returns the default keymap when no others are registered' do
          Defined.keymaps.must_equal(['_global_keymap_'])
        end

        it 'returns all keymaps currently registered' do
          Vedeu.keys('flerovium') do
            key('u') { :some_action }
          end

          Defined.keymaps.must_equal(['_global_keymap_', 'flerovium'])
        end
      end

      describe '#menus' do
        before { Vedeu::Menus.reset }

        it 'returns no menus when none currently registered' do
          Defined.menus.must_equal([])
        end

        it 'returns all menus currently registered' do
          Vedeu.menu('seaborgium') { items [:promethium, :astatine, :niobium] }

          Defined.menus.must_equal(['seaborgium'])
        end
      end

    end # Defined

  end # API

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.2.12 test/lib/vedeu/api/defined_test.rb
vedeu-0.2.11 test/lib/vedeu/api/defined_test.rb
vedeu-0.2.10 test/lib/vedeu/api/defined_test.rb
vedeu-0.2.9 test/lib/vedeu/api/defined_test.rb
vedeu-0.2.8 test/lib/vedeu/api/defined_test.rb
vedeu-0.2.7 test/lib/vedeu/api/defined_test.rb
vedeu-0.2.6 test/lib/vedeu/api/defined_test.rb
vedeu-0.2.5 test/lib/vedeu/api/defined_test.rb