On Jul 2, 2009, at 6:33 PM, Jordan Curzon wrote: > > Object#blank? is available in the tests. The behavior between this > patch an Object#blank? is identical so the only test to differentiate > would be to say should_not_receive(:blank?) which seems pretty fine > grained. It also doesn't seem like a very good idea to undefine > Object#blank?
blank? is only available if you have Rails installed, I think.. Try those tests on a machine with no rails. > > I wanted a test for this code, but due to the difference between the > modules loaded during runtime and testing, I couldn't think of any > good ones. We are not testing the the code that will be running, we > are testing code similar to what will be running. I tried to track > down how active_support gets included but it must be a dependency of a > dependency. If I open irb and require 'puppet' Object#blank? is > already defined. That is why it confused me so much to find it > undefined in the mongrel request handling loop. I think that blank? is a Rails monkey-patch, and not all Puppet users will have Rails installed. > > On Jul 2, 1:59 pm, Luke Kanies <[email protected]> wrote: >> Doesn't this change the test? Or at least require an additional >> test? >> >> On Jul 2, 2009, at 2:47 PM, Jordan Curzon wrote: >> >> >> >> >> >>> Signed-off-by: Jordan Curzon <[email protected]> >>> --- >>> lib/puppet/network/http/handler.rb | 2 +- >>> 1 files changed, 1 insertions(+), 1 deletions(-) >> >>> diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/ >>> network/ >>> http/handler.rb >>> index c6b809d..7a2408c 100644 >>> --- a/lib/puppet/network/http/handler.rb >>> +++ b/lib/puppet/network/http/handler.rb >>> @@ -182,7 +182,7 @@ module Puppet::Network::HTTP::Handler >>> def decode_params(params) >>> params.inject({}) do |result, ary| >>> param, value = ary >>> - next result if param.blank? >>> + next result if param.nil? || param.empty? >> >>> param = param.to_sym >> >>> -- >>> 1.6.3.3 >> >> -- >> Beware of all enterprises that require new clothes. >> -- Henry David Thoreau >> --------------------------------------------------------------------- >> Luke Kanies |http://reductivelabs.com|http://madstop.com > > -- I don't know the key to success, but the key to failure is trying to please everybody. -- Bill Cosby --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
