Sha256: 8cd19ec2fc3d5f415e31ac0e8d5d9c422ee090700da88e21038d4205e89d1dd1

Contents?: true

Size: 1023 Bytes

Versions: 1

Compression:

Stored size: 1023 Bytes

Contents

# frozen_string_literal: true

# This file is part of Alexandria.
#
# See the file README.md for authorship and licensing information.

require 'spec_helper'

RSpec.describe Alexandria::LibraryStore do
  let(:loader) { described_class.new(TESTDIR) }

  describe '#load_all_smart_libraries' do
    context 'when none exist' do
      it 'creates and saves some' do
        smart_libs = loader.load_all_smart_libraries
        aggregate_failures do
          expect(smart_libs.size).to eq 5
          smart_libs.each do |lib|
            expect(File.exist? lib.yaml).to be_truthy
          end
        end
      end
    end

    context 'when one exists' do
      it 'returns the existing smart library' do
        existing = Alexandria::SmartLibrary.new('Hi', [], :all, loader)
        existing.save
        smart_libs = loader.load_all_smart_libraries
        aggregate_failures do
          expect(smart_libs.size).to eq 1
          expect(smart_libs.first.yaml).to eq existing.yaml
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.3 spec/alexandria/library_store_spec.rb