Sha256: e965fbd7b79e25026d5875b1ff6b756ad9668eb787a15d22ea43fa27227cc467

Contents?: true

Size: 982 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

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