1
0
postdoc/test/models/mailbox_test.rb
2020-12-06 21:05:11 +01:00

21 lines
664 B
Ruby

require 'test_helper'
class MailboxTest < ActiveSupport::TestCase
test "generates a sendgrid mock api token on save" do
mailbox = Mailbox.new(name: 'My Mailbox',
sendgrid_api_token: '1234')
mailbox.save
assert_predicate mailbox.sendgrid_mock_api_token, :present?
end
test "does not regenerate the sendgrid_mock_api_token on save" do
mailbox = Mailbox.new(name: 'My Mailbox',
sendgrid_api_token: '1234',
sendgrid_mock_api_token: 'This is my test token')
mailbox.save
assert_equal 'This is my test token', mailbox.sendgrid_mock_api_token
end
end