Skip to content

Commit

Permalink
Reversed restore condition for RAKE_COLUMNS. Fixed #146
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jul 26, 2016
1 parent 46da613 commit f413799
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/test_rake_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ def test_terminal_columns
assert_equal 42, app.terminal_columns
ensure
if old_rake_columns
ENV['RAKE_COLUMNS'].delete
else
ENV['RAKE_COLUMNS'] = old_rake_columns
else
ENV.delete 'RAKE_COLUMNS'
end
end

Expand Down

1 comment on commit f413799

@MarkDBlackwell
Copy link
Contributor

@MarkDBlackwell MarkDBlackwell commented on f413799 Jul 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just now, I've become aware that ::ENV[]= is documented (for YARV Ruby 2.2.5) as:

"Sets the environment variable name to value. If the value given is nil the environment variable is deleted."

In that light, briefer code implementing the above functionality would be:

ensure
  ENV['RAKE_COLUMNS'] = old_rake_columns
end

But I don't know whether ::ENV[]= works that same way in all the Rubies (and their versions) which Rake supports.

Please sign in to comment.