Sha256: bce7474852371ae6de8e5506957625f181866ffd235e4f9c6bb3392719e23535

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 Bytes

Contents

require 'spec_helper'

describe "Mailer", type: :request do
  before :each do
    @user = User.create name: 'Elmer', last_name: 'Fudd', address: '1234 Somewhere, Over NY 11111', email: 'elmer@fudd.com'
  end

  it "attaches an xlsx file" do
    visit "/users/#{@user.id}/send_instructions"
    last_email = ActionMailer::Base.deliveries.last
    expect(last_email.to).to eq([@user.email])
    expect(last_email.attachments.first).to be
    expect(last_email.attachments.first.body.to_s).not_to be_empty
    expect(last_email.attachments.first.content_type).to eq(Mime::XLSX.to_s + (Rails.version < '4.0' ? '; charset=UTF-8' : ''))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workbook_rails-0.1.1 spec/workbook_mailer_spec.rb
workbook_rails-0.1.0 spec/workbook_mailer_spec.rb