Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests #5

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Add tests #5

wants to merge 3 commits into from

Conversation

kohrVid
Copy link

@kohrVid kohrVid commented Sep 19, 2022

Closes: #1
WIP - Adding tests to the gem

Though the gem will support non-Rails applications, I have decided to
use the `:rails` profile in SimpleCov as this was the easiest way to
ensure that the correct files were added to the code coverage
statistics.
This is a Rails method [1] used in the Base class. In order to support
non-rails applications, it's necessary to monkeypatch the Hash class.

[1]: https://apidock.com/rails/v5.2.3/Hash/transform_values
This commit adds a test to ensure that a new Message instance is created
when the `Base#mail` method is called. In order to do this, it was
necessary to add a new private method to the Base class as the
`instance_variable_names` method called is a Rails-only method [1] and
so would have raised an exception in a non-Rails application.

[1]: https://apidock.com/rails/v5.2.3/Object/instance_variable_names
Copy link
Member

@hammady hammady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good start.

lib/amazon_ses_mailer/base.rb Show resolved Hide resolved
lib/core_extensions/hash.rb Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write tests for the gem
2 participants