diff --git a/app/models/wiki_directory.rb b/app/models/wiki_directory.rb index 561e5a497bc..9340fc2dbbe 100644 --- a/app/models/wiki_directory.rb +++ b/app/models/wiki_directory.rb @@ -1,14 +1,13 @@ class WikiDirectory include ActiveModel::Validations - attr_accessor :slug, :pages, :directories + attr_accessor :slug, :pages validates :slug, presence: true - def initialize(slug, pages = [], directories = []) + def initialize(slug, pages = []) @slug = slug @pages = pages - @directories = directories end # Relative path to the partial to be used when rendering collections diff --git a/spec/models/wiki_directory_spec.rb b/spec/models/wiki_directory_spec.rb index fac70f8d3c7..1caaa557085 100644 --- a/spec/models/wiki_directory_spec.rb +++ b/spec/models/wiki_directory_spec.rb @@ -8,10 +8,9 @@ RSpec.describe WikiDirectory, models: true do end describe '#initialize' do - context 'when there are pages and directories' do + context 'when there are pages' do let(:pages) { [build(:wiki_page)] } - let(:other_directories) { [build(:wiki_directory)] } - let(:directory) { WikiDirectory.new('/path_up_to/dir', pages, other_directories) } + let(:directory) { WikiDirectory.new('/path_up_to/dir', pages) } it 'sets the slug attribute' do expect(directory.slug).to eq('/path_up_to/dir') @@ -20,13 +19,9 @@ RSpec.describe WikiDirectory, models: true do it 'sets the pages attribute' do expect(directory.pages).to eq(pages) end - - it 'sets the directories attribute' do - expect(directory.directories).to eq(other_directories) - end end - context 'when there are no pages or directories' do + context 'when there are no pages' do let(:directory) { WikiDirectory.new('/path_up_to/dir') } it 'sets the slug attribute' do @@ -36,10 +31,6 @@ RSpec.describe WikiDirectory, models: true do it 'sets the pages attribute to an empty array' do expect(directory.pages).to eq([]) end - - it 'sets the directories attribute to an empty array' do - expect(directory.directories).to eq([]) - end end end