aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2015-04-19 20:23:19 -0400
committerSantiago Pastorino <santiago@wyeworks.com>2015-06-11 16:54:12 -0300
commit6d2b405a4e4f6e076dfda11438efc5d21b1ff2a2 (patch)
tree84acb12a628a851a63c366f2399ea9fca87532a2
parent451b1e35746fc1f7089200ac20811080089ef192 (diff)
downloadrails-6d2b405a4e4f6e076dfda11438efc5d21b1ff2a2.tar.gz
rails-6d2b405a4e4f6e076dfda11438efc5d21b1ff2a2.tar.bz2
rails-6d2b405a4e4f6e076dfda11438efc5d21b1ff2a2.zip
Api apps scaffold does not generate views
-rw-r--r--railties/lib/rails/generators.rb3
-rw-r--r--railties/test/application/generators_test.rb1
-rw-r--r--railties/test/generators/scaffold_generator_test.rb9
3 files changed, 11 insertions, 2 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index 8239c9bd9e..0f99df4f57 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -107,7 +107,8 @@ module Rails
hide_namespaces "assets", "helper", "css", "js"
options[:rails].merge!(
- api: true
+ api: true,
+ template_engine: nil
)
end
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb
index def57f360b..0cca7a50b1 100644
--- a/railties/test/application/generators_test.rb
+++ b/railties/test/application/generators_test.rb
@@ -140,6 +140,7 @@ module ApplicationTests
assert Rails::Generators.hidden_namespaces.include?("js")
assert Rails::Generators.hidden_namespaces.include?("css")
assert Rails::Generators.options[:rails][:api]
+ assert_nil Rails::Generators.options[:rails][:template_engine]
end
end
end
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index bb08b92126..fed2982abd 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -88,7 +88,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
def test_api_scaffold_on_invoke
- run_generator %w(product_line title:string product:belongs_to user:references --api)
+ run_generator %w(product_line title:string product:belongs_to user:references --api --no-template-engine)
# Model
assert_file "app/models/product_line.rb", /class ProductLine < ActiveRecord::Base/
@@ -140,6 +140,13 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_match(/patch :update, params: \{ id: @product_line, product_line: \{ product_id: @product_line\.product_id, title: @product_line\.title, user_id: @product_line\.user_id \} \}/, test)
assert_no_match(/assert_redirected_to/, test)
end
+
+ # Views
+ assert_no_file "app/views/layouts/product_lines.html.erb"
+
+ %w(index show new edit _form).each do |view|
+ assert_no_file "app/views/product_lines/#{view}.html.erb"
+ end
end
def test_functional_tests_without_attributes