Permalink
Browse files

Removed rest of Symbol#to_proc from railties tests

  • Loading branch information...
1 parent 236169e commit bab2bfa69220ca1b6c7b56dccc79cf8e41245306 @jeremy jeremy committed Apr 23, 2009
Showing with 3 additions and 3 deletions.
  1. +1 −1 railties/test/gem_dependency_test.rb
  2. +2 −2 railties/test/plugin_test_helper.rb
@@ -18,7 +18,7 @@ def setup
def test_configuration_adds_gem_dependency
config = Rails::Configuration.new
config.gem "xaws-s3x", :lib => "aws/s3", :version => "0.4.0"
- assert_equal [["install", "xaws-s3x", "--version", '"= 0.4.0"']], config.gems.collect(&:install_command)
+ assert_equal [["install", "xaws-s3x", "--version", '"= 0.4.0"']], config.gems.collect { |g| g.install_command }
end
def test_gem_creates_install_command
@@ -24,6 +24,6 @@ def plugin_fixture_path(path)
end
def assert_plugins(list_of_names, array_of_plugins, message=nil)
- assert_equal list_of_names.map(&:to_s), array_of_plugins.map(&:name), message
+ assert_equal list_of_names.map { |n| n.to_s }, array_of_plugins.map { |p| p.name }, message
end
-end
+end

6 comments on commit bab2bfa

xguz replied Apr 23, 2009

why is Symbol#to_proc being removed? is it considered bad style or are there other (compatibility || performance) issues?

Contributor

yaroslav replied Apr 23, 2009

both?

I think the idea is to remove some dependency on Active Support from the tests, no? It looks like Active Support's core extensions are being refactored, so it makes sense.

Owner

jeremy replied Apr 23, 2009

Yes, just removing unneeded interdependencies. Symbol#to_proc is still preferred for this kind of usage :)

It's also a good lesson for writing tests. Why test (rely on) Symbol#to_proc while testing the plugin code? If Symbol#to_proc breaks, you're going to have a bunch of other failing tests.

Contributor

eric1234 replied Apr 23, 2009

My two cents are that it would be ok to leave it. Symbol#to_proc is provided by a library that railties depends on (ActiveSupport). The fact that the library was develop for Rails is not really relevant. It could just as easily be a 3rd party utility library like Facets. In general if a library that your code depends on fails its test I would not necessarily expect your code to pass either. Only once the libraries we are dependent on passes all tests would I expect your code to pass. So using a dependent library in your tests seems like an OK thing to me.

Just my two cents. Obviously in the grand scheme of things it is not a big deal that we dropped the usage of Symbol#to_proc in these tests.

Please sign in to comment.