Here is a follow-up for anyone that is interested:
I have been using the net-http-spy gem, included in the test/dev block of
my Gemfile.
group :test, :development do
gem 'rspec-rails'
gem 'rack-test'
gem 'factory_girl_rails'
gem 'mongrel', '>= 1.2.0.pre2'
gem 'log_buddy'
gem 'net-http-spy'
end
The nil error was being raised because I had commented out the following
line from my controller (or spec_helper.rb for my tests):
Net::HTTP.http_logger_options = {:verbose => true}
Apparently, if you include the gem, you must have some kind of options set
up for the Net::HTTP.http_logger_options, or face a nil error. Adding the
above line or commenting out the gem from the Gemfile fixed my problem.
The biggest lesson I've learned here is that I should really follow the
standard advice of taking a break from debugging after few hours (I've
heard some people say .5 hours.... whatever works for you). By the time I
posted to this group, I was so brain-dead, that I missed Ben H's advice
about testing in console *AND* *isolating the environment* (running console
in test environment). When I did this, I was able to get a stack trace
that led me to the source of the problem.
Thanks Ben!
On Tue, Dec 27, 2011 at 3:09 PM, Benjamin Wanicur <[email protected]>wrote:
> Thanks for the tip Ben! I'll check that out.
>
> The reason the line numbers do not line up (sorry I forgot alter the error
> message), is that I removed all the non-essential parts of the test file
> (other test blocks), and proprietary information about the company that I
> am working for. For instance, the name of the class is really
> <MyCustomerName>ApiClient, etc.....
>
> AppSettings is a poorly named constant, set by a previous developer. I
> should change that! The AppSettings for development and testenvironments are
> identical.
>
> Sorry for the confusion. This code works in console, it also is working
> in the application. Unfortunately, I am doing some ass-backwards TDD -
> writing the tests after the code is already working.
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
>
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby