Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dgorodnichy/f607e307135d857ee2027d57937f1e71 to your computer and use it in GitHub Desktop.
Save dgorodnichy/f607e307135d857ee2027d57937f1e71 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
require 'test_helper'
class NotifyPostAuthorAboutLikeActionScriptTest < ActiveSupport::TestCase
def setup
@user = users(:john_doe)
@post = posts(:lorem_ipsum)
end
def test_it_creates_notification
result = NotifyPostAuthorAboutLikeActionScript.new(@post).perform
assert result.success?
assert @user.notifications.present?
end
def test_it_show_errros_on_fail_case
result = NotifyPostAuthorAboutLikeActionScript.new(nil).perform
assert_not result.success?
assert_not_empty result.errors
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment