I am trying to test a functionality, which inserts few details into the DB. In the test.log, it shows the insert command that is generated and also the log messages that I have placed to show the progress and everything seems to be working fine except the actual data is not getting inserted into the DB. I am checking whether data is inserted in db/test.sqlite3. No exception is generated when the test cases are run. Is there a setting, which I have to set inorder to insert data into the test DB? or am i missing anything else
Thanks
I am trying to test a functionality, which inserts few details into the DB.
Share
Are you checking the database after the test is run?
By default Rails runs all tests usings transactions. This means after each test is run, the database is rolled back.
This is preferred for testing. Otherwise you may have one test tainting the data or state which affects another test.