Permalink
Browse files

Namespaced StringQuestioneer under ActiveSupport.

  • Loading branch information...
1 parent 1e4fae4 commit 6e85f14817cddb53875e572770bf3739f82e155f @josh josh committed Jun 4, 2008
@@ -1,9 +1,11 @@
-class StringQuestioneer < String
- def method_missing(method_name, *arguments)
- if method_name.to_s.ends_with?("?")
- self == method_name.to_s[0..-2]
- else
- super
+module ActiveSupport
+ class StringQuestioneer < String
+ def method_missing(method_name, *arguments)
+ if method_name.to_s.ends_with?("?")
+ self == method_name.to_s[0..-2]
+ else
+ super
+ end
end
end
-end
+end
@@ -2,14 +2,14 @@
class StringQuestioneerTest < Test::Unit::TestCase
def test_match
- assert StringQuestioneer.new("production").production?
+ assert ActiveSupport::StringQuestioneer.new("production").production?
end
def test_miss
- assert !StringQuestioneer.new("production").development?
+ assert !ActiveSupport::StringQuestioneer.new("production").development?
end
def test_missing_question_mark
- assert_raises(NoMethodError) { StringQuestioneer.new("production").production }
+ assert_raises(NoMethodError) { ActiveSupport::StringQuestioneer.new("production").production }
end
end
@@ -37,7 +37,7 @@ def root
end
def env
- StringQuestioneer.new(RAILS_ENV)
+ ActiveSupport::StringQuestioneer.new(RAILS_ENV)
end
def cache

0 comments on commit 6e85f14

Please sign in to comment.