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

be_delivered expectation fails when it shouldn't #66

Open
jwoertink opened this issue Mar 24, 2022 · 4 comments
Open

be_delivered expectation fails when it shouldn't #66

jwoertink opened this issue Mar 24, 2022 · 4 comments

Comments

@jwoertink
Copy link
Member

I have a spec that looks like this:

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.

@matthewmcgarvey
Copy link
Member

For reference if someone wants to pick this up:

It does compare the body of the email so I'm not sure how it's failing

@jwoertink
Copy link
Member Author

oh, that's weird... Yeah, I wonder why it's failing 🤔

@jwoertink
Copy link
Member Author

Thinking back on this, I was using dynamic templates through SendGrid luckyframework/carbon_sendgrid_adapter#5 When using these, there isn't a body because that actually lives in SendGrid. So, the Carbon code seems to be correct, but this is a side effect to using dynamic templates where the body doesn't live in Carbon directly.

I'm not sure how to fix this, or if we even should...Spitballin maybe we could add an additional field that gets checked, but I'd say this is super low priority now.

@jwoertink
Copy link
Member Author

I'm no longer using the dynamic templates, and I'm still getting this failed. If I check Carbon::DevAdapter.delivered_emails.map(&.class.name), I can see the email I'm sending is in there, and if I print out which email is being sent, I can see it's my user, but it still fails.

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

No branches or pull requests

2 participants