Sha256: 40e02b63ac3deb63ba8eca80d7567aa862ac7f8b0c616dee46ce083991c4bbcc

Contents?: true

Size: 1.58 KB

Versions: 21

Compression:

Stored size: 1.58 KB

Contents

require 'brightcontent/resources'

module Brightcontent
  describe Resources do

    let(:array) { [1, 2, 3, 4, 5] }
    let(:resources) { Resources.new(array) }

    it 'behaves like an array' do
      expect(resources).to eq array
    end

    context 'main menu count of 4' do
      before do
        allow(Brightcontent).to receive(:main_menu_count) { 4 }
      end

      it 'gives the main menu items (with extra counting as an item)' do
        expect(resources.main_menu).to eq [1, 2, 3]
      end

      it 'gives the extra menu items' do
        expect(resources.extra_menu).to eq [4, 5]
      end

      it 'does have any exta menu items' do
        expect(resources.extra_menu?).to be_true
      end
    end

    context 'main menu count of 5' do
      before do
        allow(Brightcontent).to receive(:main_menu_count) { 5 }
      end

      it 'gives the main menu items' do
        expect(resources.main_menu).to eq array
      end

      it 'gives the extra menu items' do
        expect(resources.extra_menu).to eq []
      end

      it 'does not have any exta menu items' do
        expect(resources.extra_menu?).to be_false
      end
    end

    context 'main menu count of 6' do
      before do
        allow(Brightcontent).to receive(:main_menu_count) { 6 }
      end

      it 'gives the main menu items' do
        expect(resources.main_menu).to eq array
      end

      it 'gives the extra menu items' do
        expect(resources.extra_menu).to eq []
      end

      it 'does not have any exta menu items' do
        expect(resources.extra_menu?).to be_false
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
brightcontent-core-2.4.6 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.4.5 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.4.4 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.4.3 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.4.2 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.4.1 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.4.0 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.3.4 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.3.3 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.3.2 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.3.1 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.3.0 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.2.2 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.2.1 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.2.0 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.1.5 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.1.4 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.1.3 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.1.2 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.1.1 spec/lib/brightcontent/resources_spec.rb