Skip to content
Browse files

fix test warnings

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4386 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 05a17dc commit d31830cf9cc863ed2f98c2d4cb90cf0e5d93e73e @jeremy jeremy committed May 31, 2006
View
6 activesupport/lib/active_support/core_ext/load_error.rb
@@ -8,20 +8,20 @@ def initialize(message, path)
def is_missing?(path)
path.gsub(/\.rb$/, '') == self.path.gsub(/\.rb$/, '')
end
-
+
def self.from_message(message)
REGEXPS.each do |regexp, capture|
match = regexp.match(message)
return MissingSourceFile.new(message, match[capture]) unless match.nil?
end
nil
end
-
+
REGEXPS = [
[/^no such file to load -- (.+)$/i, 1],
[/^Missing \w+ (file\s*)?([^\s]+.rb)$/i, 2],
[/^Missing API definition file in (.+)$/i, 1]
- ]
+ ] unless defined?(REGEXPS)
end
module ActiveSupport #:nodoc:
View
46 activesupport/lib/active_support/ordered_options.rb
@@ -1,35 +1,37 @@
# OrderedHash is namespaced to prevent conflicts with other implementations
-class ActiveSupport::OrderedHash < Array #:nodoc:
- def []=(key, value)
- if pair = find_pair(key)
- pair.pop
- pair << value
- else
- self << [key, value]
+module ActiveSupport
+ class OrderedHash < Array #:nodoc:
+ def []=(key, value)
+ if pair = find_pair(key)
+ pair.pop
+ pair << value
+ else
+ self << [key, value]
+ end
end
- end
-
- def [](key)
- pair = find_pair(key)
- pair ? pair.last : nil
- end
- def keys
- self.collect { |i| i.first }
- end
+ def [](key)
+ pair = find_pair(key)
+ pair ? pair.last : nil
+ end
- private
- def find_pair(key)
- self.each { |i| return i if i.first == key }
- return false
+ def keys
+ self.collect { |i| i.first }
end
+
+ private
+ def find_pair(key)
+ self.each { |i| return i if i.first == key }
+ return false
+ end
+ end
end
class OrderedOptions < ActiveSupport::OrderedHash #:nodoc:
def []=(key, value)
super(key.to_sym, value)
end
-
+
def [](key)
super(key.to_sym)
end
@@ -41,4 +43,4 @@ def method_missing(name, *args)
self[name]
end
end
-end
+end
View
2 activesupport/lib/active_support/values/time_zone.rb
@@ -169,7 +169,7 @@ def [](arg)
# A regular expression that matches the names of all time zones in
# the USA.
- US_ZONES = /US|Arizona|Indiana|Hawaii|Alaska/
+ US_ZONES = /US|Arizona|Indiana|Hawaii|Alaska/ unless defined?(US_ZONES)
# A convenience method for returning a collection of TimeZone objects
# for time zones in the USA.
View
2 activesupport/test/core_ext/kernel_test.rb
@@ -34,6 +34,8 @@ def test_silence_stderr
old_stderr_position = STDERR.tell
silence_stderr { STDERR.puts 'hello world' }
assert_equal old_stderr_position, STDERR.tell
+ rescue Errno::ESPIPE
+ # Skip if we can't STDERR.tell
end
def test_silence_stderr_with_return_value
View
4 activesupport/test/core_ext/module_test.rb
@@ -127,7 +127,7 @@ def teardown
end
def test_alias_method_chain
- assert @instance.respond_to? :bar
+ assert @instance.respond_to?(:bar)
feature_aliases = [:bar_with_baz, :bar_without_baz]
feature_aliases.each do |method|
@@ -152,7 +152,7 @@ def test_alias_method_chain_with_punctuation_method
FooClassWithBarMethod.send(:include, BarMethodAliaser)
FooClassWithBarMethod.alias_method_chain :quux!, :baz
assert @instance.respond_to?(:quux_with_baz)
-
+
assert_equal 'quux_with_baz', @instance.quux!
assert_equal 'quux', @instance.quux_without_baz
end

0 comments on commit d31830c

Please sign in to comment.
Something went wrong with that request. Please try again.