Permalink
Browse files

Distinguish test for 1.8.6 compat

  • Loading branch information...
jeremy committed Apr 16, 2010
1 parent c519215 commit c55cdd816c9067fd22497c94f598c7a8a59b7f49
Showing with 2 additions and 2 deletions.
  1. +2 −2 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

This comment has been minimized.

Show comment
Hide comment
@mislav

mislav Apr 17, 2010

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 :/

Member

mislav replied Apr 17, 2010

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

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Apr 17, 2010

Member

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

Member

jeremy replied Apr 17, 2010

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

@mislav

This comment has been minimized.

Show comment
Hide comment
@mislav

mislav Apr 17, 2010

Member

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

Member

mislav replied Apr 17, 2010

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

@mislav

This comment has been minimized.

Show comment
Hide comment
@mislav

mislav Apr 17, 2010

Member

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

Member

mislav replied Apr 17, 2010

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

@jeremy

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Apr 17, 2010

Member

Pulled. Thanks!

Member

jeremy replied Apr 17, 2010

Pulled. Thanks!

Please sign in to comment.