I got a set of tests for a Ruby app. The first fails unexpectedly
("wrong number of args"). I added code to show that the app works as
I think it should. Any ideas?
The code is below:
I'm running:
Rails 2.3.5, Ruby 1.8.6, WinXP-Pro/SP3, Firefox 3.6.2, Firebug 1.5.3,
MySQL 5.0.37-community-nt, Mongrel, Apache HTTP Server 2.2.15
Thanks in advance,
Richard
# GenModCRUD.rb <<<<<<<<<<<<< The Program >>>>>>>>>>>>>>>
I got a set of tests for a Ruby app. The first fails unexpectedly
("wrong number of args"). I added code to show that the app works as
I think it should. Any ideas
You're getting that error on line 12. What's on line 12? (It's hard to
tell which blank and comment lines are really in your code.)
The code is below:
I'm running:
Rails 2.3.5, Ruby 1.8.6, WinXP-Pro/SP3, Firefox 3.6.2, Firebug 1.5.3,
MySQL 5.0.37-community-nt, Mongrel, Apache HTTP Server 2.2.15
There is no reason to give us the details of your browser when
discussing server-side code.
Not relevant to the problem but this doesn't actually make methods
private (it's just the symbol literal 'private'). Remove the : for it
to actually do something (similarly for the public later on)
Frederick: I removed the colons from the public and private macros
Marnen: The code and the output I got from running them is at
http://www.pastie.org/963644. It's got line numbers. As you
obviously can now see, line 12 is the second line in::
Frederick: I removed the colons from the public and private macros
Marnen: The code and the output I got from running them is athttp://www.pastie.org/963644. It's got line numbers. As you
obviously can now see, line 12 is the second line in::
All problems solved.
As you suspected, no doubt, all problems were my errors. But I lacked
faith in Unit Tests so I failed to diligently investigate how reported
errors may be caused by defects in my code.
But after posting the code for a second time, I started to notice
some strange code fragments. Ultimately I found three defects in my
app that caused the three unexpected things in the test output. As I
said, all defects have been ameliorated, resulting in a clean Unit
Test report.
Thank you both for continuing to help be gain strength, little by
little, in Ruby/Rails programming.
The problem is that the function crud_views_as_a_string is not defined
(GenModCRUD.rb:22:` def crud_views_as_a_string') to take an argument.
But in your test you are calling it with an argument :string
(TestGMC.rb:12: `crud_views_as_a_string(:string)'
I'm not sure what you're testing, but to simply remove the error, you
would want TestGMC.rb:12 line to read: