I was using Mysql database before and decided to switch to Postgresql and now, when I run my tests using rspec, I getting a lot of warnings and notices.
WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
should has link "Suspender"
WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
should has css "title" with text "Suspensão de anúncio"
WARNING: there is already a transaction in progress
NOTICE: there is no transaction in progress
should has css "h1" with text "Awesome job!"
How can I suppress that? Is there a way, right?
If the deprecations are coming mostly from Rails, it may be time to disable the messages and save yourself from messy terminal output. The TL;DR is that you need to use RUBYOPT='-W:no-deprecated -W:no-experimental' to disable the deprecations. This will also disable experimental feature warnings as well.
I use the database_cleaner gem to scrub my test database before each test runs, ensuring a clean slate and stable baseline every time. By default, RSpec will actually do this for you, running every test with a database transaction and then rolling back that transaction after it finishes.
RSpec is a testing tool for Ruby, created for behavior-driven development (BDD). It is the most frequently used testing library for Ruby in production applications. Even though it has a very rich and powerful DSL (domain-specific language), at its core it is a simple tool which you can start using rather quickly.
Did you set: config.use_transactional_examples = true
to false and see if that breaks anything?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With