Permalink
Browse files

Merge pull request #1786 from gazay/3-1-stable-regexp-fix

Fix regexp in generators for right catching error message
  • Loading branch information...
2 parents ac78ff7 + 91bbb8e commit 8a889dd45e088014c77f4cd799c9e5ddea0b54c6 @josevalim josevalim committed Jun 20, 2011
@@ -299,9 +299,6 @@ def self.lookup(namespaces) #:nodoc:
return
rescue LoadError => e
raise unless e.message =~ /#{Regexp.escape(path)}$/
- rescue NameError => e
- raise unless e.message =~ /Rails::Generator([\s(::)]|$)/
- warn "[WARNING] Could not load generator #{path.inspect} because it's a Rails 2.x generator, which is not supported anymore. Error: #{e.message}.\n#{e.backtrace.join("\n")}"
rescue Exception => e
warn "[WARNING] Could not load generator #{path.inspect}. Error: #{e.message}.\n#{e.backtrace.join("\n")}"
end
@@ -1,3 +0,0 @@
-# Old generator version
-class WrongGenerator < Rails::Generator::NamedBase
-end
@@ -88,12 +88,6 @@ def test_find_by_namespace_without_base_or_context_looks_into_rails_namespace
assert Rails::Generators.find_by_namespace(:model)
end
- def test_find_by_namespace_show_warning_if_generator_cant_be_loaded
- output = capture(:stderr) { Rails::Generators.find_by_namespace(:wrong) }
- assert_match(/\[WARNING\] Could not load generator/, output)
- assert_match(/Rails 2\.x generator/, output)
- end
-
def test_invoke_with_nested_namespaces
model_generator = mock('ModelGenerator') do
expects(:start).with(["Account"], {})

0 comments on commit 8a889dd

Please sign in to comment.