Sha256: d73da136573b2af5b16e18cc886f62bae0acad61becc760845a8065949c5c2a5

Contents?: true

Size: 982 Bytes

Versions: 6

Compression:

Stored size: 982 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::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)
      expect(lib.name.encoding.name).to eq "UTF-8"
      expect(bad_name.encoding.name).to eq "US-ASCII"
    end
  end

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

    it "works when given no parameters" do
      lib.update
    end

    it "works when given a LibraryCollection" do
      lib.update Alexandria::LibraryCollection.instance
    end

    it "works when given a Library" do
      lib.update Alexandria::Library.new("Hi")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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