Skip to content
Browse files

Distinguish test for 1.8.6 compat

  • Loading branch information...
1 parent c519215 commit c55cdd816c9067fd22497c94f598c7a8a59b7f49 @jeremy jeremy committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 activesupport/test/core_ext/string_ext_test.rb
View
4 activesupport/test/core_ext/string_ext_test.rb
@@ -177,7 +177,7 @@ def test_starts_ends_with_alias
s = "hello"
assert s.starts_with?('h')
assert s.starts_with?('hel')
- assert !s.starts_with?(:hel)
+ assert !s.starts_with?(:hel) if :hel.respond_to?(:length)
assert !s.starts_with?('el')
assert s.start_with?('h')
@@ -186,7 +186,7 @@ def test_starts_ends_with_alias
assert s.ends_with?('o')
assert s.ends_with?('lo')
- assert !s.ends_with?(:lo)
+ assert !s.ends_with?(:lo) if :lo.respond_to?(:length)
assert !s.ends_with?('el')
assert s.end_with?('o')

5 comments on commit c55cdd8

@mislav
Ruby on Rails member

Why was this necessary? With this change, you made this test be skipped in ruby 1.8.6, which was the target version for this test in the first place.

Now these lines only run in Ruby 1.9 :/

@jeremy
Ruby on Rails member

Because the test failed on 1.8.6. Did you mean to test that !s.ends_with?(:lo) may raise NoMethodError?

@mislav
Ruby on Rails member

It shouldn't. Looks like I didn't solve it properly. Will patch it now

@mislav
Ruby on Rails member

Pushed to "starts_ends" branch in my fork. Please pull. They should return false for non-strings

@jeremy
Ruby on Rails member

Pulled. Thanks!

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