1
0
postdoc/test/models/mailbox_test.rb

21 lines
664 B
Ruby
Raw Normal View History

2020-12-06 20:49:03 +01:00
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