Skip to content

Commit

Permalink
Distinguish test for 1.8.6 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Apr 16, 2010
1 parent c519215 commit c55cdd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activesupport/test/core_ext/string_ext_test.rb
Expand Up @@ -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')
Expand All @@ -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')
Expand Down

5 comments on commit c55cdd8

@mislav
Copy link
Member

@mislav mislav commented on c55cdd8 Apr 17, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member Author

@jeremy jeremy commented on c55cdd8 Apr 17, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@mislav
Copy link
Member

@mislav mislav commented on c55cdd8 Apr 17, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@mislav
Copy link
Member

@mislav mislav commented on c55cdd8 Apr 17, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@jeremy
Copy link
Member Author

@jeremy jeremy commented on c55cdd8 Apr 17, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled. Thanks!

Please sign in to comment.