mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Api apps scaffold does not generate helpers
This commit is contained in:
parent
6d2b405a4e
commit
e5b6188b47
3 changed files with 6 additions and 1 deletions
|
@ -108,6 +108,7 @@ module Rails
|
||||||
|
|
||||||
options[:rails].merge!(
|
options[:rails].merge!(
|
||||||
api: true,
|
api: true,
|
||||||
|
helper: false,
|
||||||
template_engine: nil
|
template_engine: nil
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -140,6 +140,7 @@ module ApplicationTests
|
||||||
assert Rails::Generators.hidden_namespaces.include?("js")
|
assert Rails::Generators.hidden_namespaces.include?("js")
|
||||||
assert Rails::Generators.hidden_namespaces.include?("css")
|
assert Rails::Generators.hidden_namespaces.include?("css")
|
||||||
assert Rails::Generators.options[:rails][:api]
|
assert Rails::Generators.options[:rails][:api]
|
||||||
|
assert_equal false, Rails::Generators.options[:rails][:helper]
|
||||||
assert_nil Rails::Generators.options[:rails][:template_engine]
|
assert_nil Rails::Generators.options[:rails][:template_engine]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,7 +88,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_api_scaffold_on_invoke
|
def test_api_scaffold_on_invoke
|
||||||
run_generator %w(product_line title:string product:belongs_to user:references --api --no-template-engine)
|
run_generator %w(product_line title:string product:belongs_to user:references --api --no-template-engine --no-helper)
|
||||||
|
|
||||||
# Model
|
# Model
|
||||||
assert_file "app/models/product_line.rb", /class ProductLine < ActiveRecord::Base/
|
assert_file "app/models/product_line.rb", /class ProductLine < ActiveRecord::Base/
|
||||||
|
@ -147,6 +147,9 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
||||||
%w(index show new edit _form).each do |view|
|
%w(index show new edit _form).each do |view|
|
||||||
assert_no_file "app/views/product_lines/#{view}.html.erb"
|
assert_no_file "app/views/product_lines/#{view}.html.erb"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Helpers
|
||||||
|
assert_no_file "app/helpers/product_lines_helper.rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_functional_tests_without_attributes
|
def test_functional_tests_without_attributes
|
||||||
|
|
Loading…
Reference in a new issue