Sha256: 12a9e5a2e6d8d093ed8dd7a8740241bcc73fa2ce3778e51c8a7b9a46ae10dc50

Contents?: true

Size: 929 Bytes

Versions: 8

Compression:

Stored size: 929 Bytes

Contents

# frozen_string_literal: true

describe Spotlight::IndexingCompleteMailer do
  subject { described_class.documents_indexed [1, 2, 3], exhibit, user }

  let(:user) { double(email: 'test@example.com') }
  let(:exhibit) { double(title: 'Exhibit title') }

  it 'renders the receiver email' do
    expect(subject.to).to eql([user.email])
  end

  it 'includes a title' do
    expect(subject.body.encoded).to match 'Your CSV file has just finished being processed'
  end

  it 'describes how many documents were indexed' do
    expect(subject.body.encoded).to match '3 documents'
  end

  context 'single item' do
    subject { described_class.documents_indexed [1], exhibit, user }

    it 'handles pluralization when only a single item was indexed' do
      expect(subject.body.encoded).to match '1 document has'
    end
  end

  it 'includes the exhibit title' do
    expect(subject.body.encoded).to match exhibit.title
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.10 spec/mailers/spotlight/indexing_complete_mailer_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/mailers/spotlight/indexing_complete_mailer_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/mailers/spotlight/indexing_complete_mailer_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/mailers/spotlight/indexing_complete_mailer_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/mailers/spotlight/indexing_complete_mailer_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/mailers/spotlight/indexing_complete_mailer_spec.rb
blacklight-spotlight-3.0.0.alpha.4 spec/mailers/spotlight/indexing_complete_mailer_spec.rb
blacklight-spotlight-3.0.0.alpha.3 spec/mailers/spotlight/indexing_complete_mailer_spec.rb