This project is archived and is in readonly mode.
Make Inflector#parameterize correctly squeeze multi-character separators
-
Christoffer Sawicki
Henrik is right; if
parameterizeis supposed to handle multi-char separators, then the current implementation is buggy and Henrik's patch should be applied. In that case: +1However, as Henrik also says, if only one-char separators are to be supported, then that pre-condition should be checked. In this case, another fix should be created and applied.
-
Pratik
- Assigned user set to Pratik
- State changed from new to incomplete
I get the following test failure after applying the patch.
1) Error: test_string_parameterized_no_separator(StringInflectionsTest): RegexpError: invalid regular expression; there's no previous pattern, to which '{' would define cardinality at 1: /{2,}/ ./test/../lib/active_support/inflector.rb:266:in `parameterize' ./test/../lib/active_support/core_ext/string/inflections.rb:106:in `parameterize' ./test/core_ext/string_ext_test.rb:88:in `test_string_parameterized_no_separator' ./test/core_ext/string_ext_test.rb:87:in `each' ./test/core_ext/string_ext_test.rb:87:in `test_string_parameterized_no_separator' /opt/local/lib/ruby/gems/1.8/gems/mocha-0.9.5/lib/mocha/test_case_adapter.rb:69:in `__send__' /opt/local/lib/ruby/gems/1.8/gems/mocha-0.9.5/lib/mocha/test_case_adapter.rb:69:in `run'Thanks.
-
Henrik Nyh
Thanks, Pratik. Fixed in second patch.
-
Henrik Nyh
Moved comment, re-attaching second patch.
-
Repository
- State changed from incomplete to resolved
(from [ea0e41d8fa5a132a2d2771e9785833b7663203ac]) Make Inflector#parameterize correctly squeeze multi-character separators [#1489 Make Inflector#parameterize correctly squeeze multi-character separators state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
