Sha256: 40f1119b62231c11492f0bbd9a8e3bed5bea7d58ff3e4e1ce0c3ae3e58559df2

Contents?: true

Size: 1.63 KB

Versions: 17

Compression:

Stored size: 1.63 KB

Contents

require 'test_helper'

module Vedeu

  module DSL

    describe Menu do

      let(:described)  { Vedeu::DSL::Menu }
      let(:instance)   { described.new(model) }
      let(:model)      { Vedeu::Menu.new(attributes) }
      let(:attributes) {
        {
          collection: collection,
          name:       menu_name,
        }
      }
      let(:collection) { [:sodium, :magnesium, :aluminium, :silicon] }
      let(:menu_name)  { 'elements' }

      describe '#initialize' do
        it { instance.must_be_instance_of(Vedeu::DSL::Menu) }
        it { instance.instance_variable_get('@model').must_equal(model) }
      end

      describe '#item' do
        let(:value) { :platinum }

        subject { instance.item(value) }

        context 'when items are provided' do
          it { subject.must_equal([:sodium,
                                    :magnesium,
                                    :aluminium,
                                    :silicon,
                                    :platinum]) }
        end
      end

      describe '#items' do
        let(:value) { [] }

        subject { instance.items(value) }

        context 'when no items are provided' do
          it { subject.must_equal([]) }
        end

        context 'when items are provided' do
          let(:value) { [:gold, :silver, :tin] }

          it { subject.must_equal(value)}
        end
      end

      describe '#name' do
        let(:value) { 'metals' }

        subject { instance.name(value) }

        it 'returns the name of the menu' do
          subject
          model.name.must_equal('metals')
        end
      end

    end # Menu

  end # DSL

end # Vedeu

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
vedeu-0.4.16 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.15 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.14 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.13 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.12 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.11 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.10 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.9 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.8 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.7 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.6 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.5 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.4 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.3 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.2 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.1 test/lib/vedeu/dsl/components/menu_test.rb
vedeu-0.4.0 test/lib/vedeu/dsl/components/menu_test.rb