luckyframework / luckyframework/carbon

be_delivered expectation fails when it shouldn't

Open
#66 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Crystal
Stars
87
Forks
20
PR merge metrics
No merged PRs in 30d

Description

I have a spec that looks like this:

```crystal
NewPostEmail.new(friend, me, post).should be_delivered
NewPostEmail.new(friend, me, later_post).should_not be_delivered
```
because I'm sending bulk emails. In this case, I want to make sure the first one is sent because `post` is valid for sending at this time, but `later_post` is not, and should not be sent out. When the spec runs, it says both should be delivered, but I think it's a false positive because it sees the same `to` and same `subject` lines and probably whatever else to determine that these are the same email even though they're not.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown Crystal spec and trace how the be_delivered expectation identifies an email, especially which message fields it compares. Reproduce the case with two emails sharing a recipient and subject but using different posts. Done means the expectation distinguishes the two messages and the first passes while the second fails as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.