class StringInquirerTest
Public Instance Methods
respond_to_missing?(name, include_private = false)
click to toggle source
Calls superclass method
# File activesupport/test/string_inquirer_test.rb, line 28 def respond_to_missing?(name, include_private = false) (name == :bar) || super end
setup()
click to toggle source
# File activesupport/test/string_inquirer_test.rb, line 6 def setup @string_inquirer = ActiveSupport::StringInquirer.new("production") end
test_match()
click to toggle source
# File activesupport/test/string_inquirer_test.rb, line 10 def test_match assert @string_inquirer.production? end
test_miss()
click to toggle source
# File activesupport/test/string_inquirer_test.rb, line 14 def test_miss assert_not @string_inquirer.development? end
test_missing_question_mark()
click to toggle source
# File activesupport/test/string_inquirer_test.rb, line 18 def test_missing_question_mark assert_raise(NoMethodError) { @string_inquirer.production } end
test_respond_to()
click to toggle source
# File activesupport/test/string_inquirer_test.rb, line 22 def test_respond_to assert_respond_to @string_inquirer, :development? end
test_respond_to_fallback_to_string_respond_to()
click to toggle source
# File activesupport/test/string_inquirer_test.rb, line 26 def test_respond_to_fallback_to_string_respond_to String.class_eval do def respond_to_missing?(name, include_private = false) (name == :bar) || super end end str = ActiveSupport::StringInquirer.new("hello") assert_respond_to str, :are_you_ready? assert_respond_to str, :bar assert_not_respond_to str, :nope ensure String.class_eval do undef_method :respond_to_missing? def respond_to_missing?(name, include_private = false) super end end end