Sha256: 09b31e2dfcfcb0d7f51de7126238db0fd188228df67ac1ea2ba12add640ac115

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

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

6 entries across 6 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.9 spec/alexandria/library_store_spec.rb
alexandria-book-collection-manager-0.7.8 spec/alexandria/library_store_spec.rb
alexandria-book-collection-manager-0.7.7 spec/alexandria/library_store_spec.rb
alexandria-book-collection-manager-0.7.6 spec/alexandria/library_store_spec.rb
alexandria-book-collection-manager-0.7.5 spec/alexandria/library_store_spec.rb
alexandria-book-collection-manager-0.7.4 spec/alexandria/library_store_spec.rb