Permalink
Browse files

Namespaced StringQuestioneer under ActiveSupport.

  • Loading branch information...
josh authored and tarmo committed Jun 4, 2008
1 parent ddb8c9c commit 5b6fb7cfeecf77121350845766f337f2b0eb7759
@@ -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
@@ -36,7 +36,7 @@ def root
end
def env
- StringQuestioneer.new(RAILS_ENV)
+ ActiveSupport::StringQuestioneer.new(RAILS_ENV)
end
def cache

0 comments on commit 5b6fb7c

Please sign in to comment.