I'm trying to configure RSpec to work with
database_cleaner<https://github.com/bmabey/database_cleaner> using
the transaction strategy and Sequel
transactions<http://sequel.jeremyevans.net/rdoc/files/doc/transactions_rdoc.html>
.
Example of code that pass my specs:
def call
DB.transaction(:savepoint => true) do
create_user
create_account
endend
------------------------------
def call
DB.transaction(:savepoint => true) do
DB.transaction do
create_user
create_account
end
endend
I don't want to modify each transaction in my code and add :savepoint =>
true. So, I keep my original code:
def call
DB.transaction do
create_user
create_account
endend
and I add in spec_helper file:
config.around(:each) do |spec|
DB.transaction(:savepoint => true) do
spec.run
endend
------------------------------
Failures:
Failure/Error: expect(users_count).to eq o
expected: 0
got: 1
This approach is not working and apparently the behaviour need to be the
same as the second working example that I wrote above. What's the problem?
I found a similar
approach<https://groups.google.com/d/msg/sequel-talk/VjfJcTD6s3w/D6nusXO_bbsJ>
in
the Sequel mailing list. I tried it too and it doesn't work for me. How I
can configure RSpec to pass my specs?
This was originally posted in StackOverflow:
http://stackoverflow.com/q/22838625/462015.
Thank you!
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.