Sha256: ac14d2ac6a68df397406be2dad34650402bd190908db96771d21dcad5eedb6dd

Contents?: true

Size: 938 Bytes

Versions: 7

Compression:

Stored size: 938 Bytes

Contents

require_relative 'spec_helper'

describe Kanpachi::SectionList do
  subject do
    Kanpachi::SectionList.new
  end

  let(:users_section) do
    Kanpachi::Section.new('Users')
  end

  let(:populated_section_list) do
    list = Kanpachi::SectionList.new
    list.add(users_section)
    list
  end

  it 'initializes empty' do
    subject.all.must_be_empty
  end

  it 'returns a hash of the internal list, with section names as the key and a Section object as the value' do
    populated_section_list.to_hash.keys.must_include 'Users'
    populated_section_list.to_hash['Users'].must_equal users_section
  end

  it 'returns an array of Section objects' do
    populated_section_list.all.must_include users_section
  end

  it 'adds a section' do
    subject.add(users_section)
    subject.all.must_include users_section
  end

  it 'finds a section by name' do
    populated_section_list.find('Users').must_equal users_section
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kanpachi-0.0.7 spec/section_list_spec.rb
kanpachi-0.0.6 spec/section_list_spec.rb
kanpachi-0.0.5 spec/section_list_spec.rb
kanpachi-0.0.4 spec/section_list_spec.rb
kanpachi-0.0.3 spec/section_list_spec.rb
kanpachi-0.0.2 spec/section_list_spec.rb
kanpachi-0.0.1 spec/section_list_spec.rb