Sha256: c890354764ddab27fdea61a24e070d84650a5cda49195253d1b6c3e0f45d6949

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 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(lib.yaml).to be_an_existing_file
          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.10 spec/alexandria/library_store_spec.rb