Sha256: 60adc684ebfea1b2c9cda7008fce73feba4da911da7b5cbc05ef0ea578295d1f

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 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::SmartLibrary do
  it "can be instantiated simply" do
    lib = described_class.new("Hello", [], :all)
    expect(lib.name).to eq "Hello"
  end

  describe "#name" do
    it "normalizes the encoding" do
      bad_name = (+"PrĂȘts").force_encoding("ascii")
      lib = described_class.new(bad_name, [], :all)
      aggregate_failures do
        expect(lib.name.encoding.name).to eq "UTF-8"
        expect(bad_name.encoding.name).to eq "US-ASCII"
      end
    end
  end

  describe "#update" do
    let(:lib) { described_class.new("Hello", [], :all) }

    it "works when given no parameters" do
      expect { lib.update }.not_to raise_error
    end

    it "works when given a LibraryCollection" do
      expect { lib.update Alexandria::LibraryCollection.instance }.not_to raise_error
    end

    it "works when given a Library" do
      expect { lib.update Alexandria::Library.new("Hi") }.not_to raise_error
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.10 spec/alexandria/smart_library_spec.rb