I''m running unit tests on one of my models, and can''t figure out what''s wrong with something. I want to be able to output the value of a variable, but can''t get it at all. I try puts, STDERR.puts, and log.info, log.error, whatever...nothing shows up on the screen along with the regular test output, and nothing shows up in test.log. I need to be able to find out what the value is inside this method...and just can''t do it for some reason. What do I need to do to see what the value is?
puts shows up fine for me but you probably want to use breakponter. just add "breakpoint" somewhere in your tests and it will drop you in irb with all the data available to you. On 8/2/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m running unit tests on one of my models, and can''t figure out > what''s wrong with something. I want to be able to output the value of > a variable, but can''t get it at all. I try puts, STDERR.puts, and > log.info, log.error, whatever...nothing shows up on the screen along > with the regular test output, and nothing shows up in test.log. I > need to be able to find out what the value is inside this method...and > just can''t do it for some reason. What do I need to do to see what > the value is? > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://www.snowdevil.ca - Snowboards that don''t suck http://typo.leetsoft.com - Open source weblog engine http://blog.leetsoft.com - Technical weblog
Do I need to do something special to make it work or something? To clarify, the variable that I need to display isn''t in the test - it''s in the model itself. Something like: class MyModel def foo(a) puts a end end If I put "breakpoint" somewhere in there, nothing happens when I run the unit test. And I don''t see anything on screen or in the log file either...somehow I need to see what the value of a is that gets passed in. On 8/2/05, Tobias Luetke <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> puts shows up fine for me but you probably want to use breakponter. > > just add "breakpoint" somewhere in your tests and it will drop you in > irb with all the data available to you. > > On 8/2/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I''m running unit tests on one of my models, and can''t figure out > > what''s wrong with something. I want to be able to output the value of > > a variable, but can''t get it at all. I try puts, STDERR.puts, and > > log.info, log.error, whatever...nothing shows up on the screen along > > with the regular test output, and nothing shows up in test.log. I > > need to be able to find out what the value is inside this method...and > > just can''t do it for some reason. What do I need to do to see what > > the value is? > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Tobi > http://www.snowdevil.ca - Snowboards that don''t suck > http://typo.leetsoft.com - Open source weblog engine > http://blog.leetsoft.com - Technical weblog >
Alright, disregard everything. I just wrote my loop wrong, so the code inside it was never getting executed. Might be time to take a nap...the code is all starting to blur together. Sorry for the waste of time. Pat On 8/2/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Do I need to do something special to make it work or something? > > To clarify, the variable that I need to display isn''t in the test - > it''s in the model itself. Something like: > class MyModel > def foo(a) > puts a > end > end > > If I put "breakpoint" somewhere in there, nothing happens when I run > the unit test. And I don''t see anything on screen or in the log file > either...somehow I need to see what the value of a is that gets passed > in. > > > > On 8/2/05, Tobias Luetke <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > puts shows up fine for me but you probably want to use breakponter. > > > > just add "breakpoint" somewhere in your tests and it will drop you in > > irb with all the data available to you. > > > > On 8/2/05, Pat Maddox <pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m running unit tests on one of my models, and can''t figure out > > > what''s wrong with something. I want to be able to output the value of > > > a variable, but can''t get it at all. I try puts, STDERR.puts, and > > > log.info, log.error, whatever...nothing shows up on the screen along > > > with the regular test output, and nothing shows up in test.log. I > > > need to be able to find out what the value is inside this method...and > > > just can''t do it for some reason. What do I need to do to see what > > > the value is? > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > -- > > Tobi > > http://www.snowdevil.ca - Snowboards that don''t suck > > http://typo.leetsoft.com - Open source weblog engine > > http://blog.leetsoft.com - Technical weblog > > >
Pat Maddox wrote:>Do I need to do something special to make it work or something? > >To clarify, the variable that I need to display isn''t in the test - >it''s in the model itself. Something like: >class MyModel > def foo(a) > puts a > end >end > > >replace "puts" with "warn" warn writes to WEBrick console and works form model, view, and controller