Sha256: a815fe9dfaaa64e34671df1060ce750503770c29a2673125ac8522394a35939f

Contents?: true

Size: 1.58 KB

Versions: 3

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 eq 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 eq 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 eq false
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
brightcontent-core-2.6.0 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.5.1 spec/lib/brightcontent/resources_spec.rb
brightcontent-core-2.5.0 spec/lib/brightcontent/resources_spec.rb