mail_view icon indicating copy to clipboard operation
mail_view copied to clipboard

Wrapping mail generation in rolled-back transaction to prevent database changes from persisting

Open costa opened this issue 10 years ago • 3 comments

I use factories for specs and I find them very convenient to use in mail_view's "actions". Factories — as well as other methods for generating sample data on the fly — need to be cleaned after. Since mail_view is supposed to be read-only, I see no disadvantage in actual prevention of data changes persistency — using transactions.

The first commit is kinda working draft for discussion, I'll add specs+docs if needed.

p.s. I've seen #69 but did neither like the solution nor understand the discussion there.

slightly-off-topic: Might be useful to include in the docs: mail_view for human — and also for automatic — testing.

costa avatar Mar 30 '14 12:03 costa

Will you guys ever integrate this in ActionMailer? It's pretty useful

Zeneixe avatar Sep 17 '14 10:09 Zeneixe

It's a nice idea. It's simple in the common case, but breaks down at the edges. Considering that seed data handles these cases nicely, or using MyModel.new without saving, there isn't great pressure to introduce an automatic transaction rollback.

jeremy avatar Sep 22 '14 22:09 jeremy

@jeremy Seed data? Using any other form of protection is great, but less convenient, that's the point of this discussion.

costa avatar Oct 02 '14 16:10 costa