carlhuda/bundler — pull request #2115 by rohit (2012-10-02 12:29:39+00:00)
Title: Fix a few warnings while running specs

So while looking at #2109 I decided to look at the warnings that show up while running specs. These were the warnings that showed up. I just gave a cursory look at why. I've attached notes on if it was fixed. If it wasn't, a note saying why.

/home/rohit/opensource/bundler/spec/quality_spec.rb:4: warning: setting Encoding.default_external

Can't fix, warning because of http://www.ruby-doc.org/core-1.9.3/Encoding.html#method-c-default_external-3D

/home/rohit/opensource/bundler/spec/cache/git_spec.rb:62: warning: possibly useless use of == in void context
/home/rohit/opensource/bundler/spec/cache/git_spec.rb:82: warning: possibly useless use of == in void context

Probably should use `err.should be == ""` or `err.should eql("")`. Warning thrown because `==` is an expression (afaik) and it's return value is not being used/stored. Why only these two warnings? I don't know that but the `obj.should == ` is used throughout bundler, so I didn't feel like changing only these two occurrences.

/home/rohit/opensource/bundler/spec/cache/git_spec.rb:146: warning: assigned but unused variable - ref
/home/rohit/opensource/bundler/spec/cache/git_spec.rb:159: warning: assigned but unused variable - ref

Fixed

/home/rohit/opensource/bundler/lib/bundler/source.rb:516: warning: method redefined; discarding old revision

IDK why the two methods are getting mixed up. Or is the file being run/parsed twice?

/home/rohit/opensource/bundler/lib/bundler/definition.rb:238: warning: assigned but unused variable - e

Fixed

/home/rohit/opensource/bundler/lib/bundler/vendor/thor/base.rb:566: warning: instance variable @no_tasks not initialized
/home/rohit/opensource/bundler/lib/bundler/vendor/thor.rb:294: warning: instance variable @long_desc not initialized

Didn't fix. As I understand it, this is vendored thor and should be as-is from upstream.

/home/rohit/opensource/bundler/spec/runtime/with_clean_env_spec.rb:32: warning: assigned but unused variable - gem_path

Fixed.

After fixing above, two more warnings showed up for `git_spec.rb` saying `git` assigned but not used. Fixed that too.