I''m wanting to be able to inspect what is actually getting written to the test database when/after tests are ran. However I do no not know how to do this. Since after each test is ran the DB is wiped. How can I somehow prevent the BD from getting cleared out after running a test so I can manually check it''s content? I am using MySQL, Shoulda and Factory Girl. Thank you. Elliott G
try this from the command line tail -f log/test.log ...and run your tests from another console hope it helps! On Nov 12, 3:41 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote:> I''m wanting to be able to inspect what is actually getting written to > the test database when/after tests are ran. > > However I do no not know how to do this. Since after each test is ran > the DB is wiped. How can I somehow prevent the BD from getting > cleared out after running a test so I can manually check it''s content? > > I am using MySQL, Shoulda and Factory Girl. > > Thank you. > Elliott G
Thanks for the reply Auvi. I have been tailing the test log. It is showing me that the records I am watching are getting update on the test db as expected. But when I do a subsequent AR find query to pull them out and run assertions on them they do not match what the test log was showing. That''s why I am trying to get a peek at the db itself. Is it poor form/problematic to run AR find queries in functional tests? Thanks, EG On Nov 12, 5:43 pm, Auvi <geta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> try this from the command line > tail -f log/test.log > ...and run your tests from another console > hope it helps! > > On Nov 12, 3:41 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > > I''m wanting to be able to inspect what is actually getting written to > > the test database when/after tests are ran. > > > However I do no not know how to do this. Since after each test is ran > > the DB is wiped. How can I somehow prevent the BD from getting > > cleared out after running a test so I can manually check it''s content? > > > I am using MySQL, Shoulda and Factory Girl. > > > Thank you. > > Elliott G
I''m not sure how Shoulda works, but in Cucumber, I can turn off transactional fixtures which retains state in the test database between scenarios. The danger with this is that tests may pass or fail based on previous state, when each scenario should really be run in isolation. Eric On Nov 12, 3:38 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote:> Thanks for the reply Auvi. > > I have been tailing the test log. It is showing me that the records I > am watching are getting update on the test db as expected. But when I > do a subsequent AR find query to pull them out and run assertions on > them they do not match what the test log was showing. That''s why I am > trying to get a peek at the db itself. > > Is it poor form/problematic to run AR find queries in functional > tests? > > Thanks, EG > > On Nov 12, 5:43 pm, Auvi <geta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > try this from the command line > > tail -f log/test.log > > ...and run your tests from another console > > hope it helps! > > > On Nov 12, 3:41 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > I''m wanting to be able to inspect what is actually getting written to > > > the test database when/after tests are ran. > > > > However I do no not know how to do this. Since after each test is ran > > > the DB is wiped. How can I somehow prevent the BD from getting > > > cleared out after running a test so I can manually check it''s content? > > > > I am using MySQL, Shoulda and Factory Girl. > > > > Thank you. > > > Elliott G
Thanks E.Litwin That worked like a charm. I just changed self.use_transactional_fixtures = false in test/ test_helper.rb from the default true to false. Thanks again, Elliott G On Nov 12, 6:57 pm, "E. Litwin" <elit...-ur4TIblo6goN+BqQ9rBEUg@public.gmane.org> wrote:> I''m not sure how Shoulda works, but in Cucumber, I can turn off > transactional fixtures which retains state in the test database > between scenarios. > > The danger with this is that tests may pass or fail based on previous > state, when each scenario should really be run in isolation. > > Eric > > On Nov 12, 3:38 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > > Thanks for the reply Auvi. > > > I have been tailing the test log. It is showing me that the records I > > am watching are getting update on the test db as expected. But when I > > do a subsequent AR find query to pull them out and run assertions on > > them they do not match what the test log was showing. That''s why I am > > trying to get a peek at the db itself. > > > Is it poor form/problematic to run AR find queries in functional > > tests? > > > Thanks, EG > > > On Nov 12, 5:43 pm, Auvi <geta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > try this from the command line > > > tail -f log/test.log > > > ...and run your tests from another console > > > hope it helps! > > > > On Nov 12, 3:41 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > > I''m wanting to be able to inspect what is actually getting written to > > > > the test database when/after tests are ran. > > > > > However I do no not know how to do this. Since after each test is ran > > > > the DB is wiped. How can I somehow prevent the BD from getting > > > > cleared out after running a test so I can manually check it''s content? > > > > > I am using MySQL, Shoulda and Factory Girl. > > > > > Thank you. > > > > Elliott G