From c19035299a314380285addf6f269591dc648d5cf Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 17 Apr 2015 20:34:21 -0300 Subject: Hide assets, helper, css and js namespaces for api only apps --- railties/test/application/generators_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'railties/test/application/generators_test.rb') diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 78ada58ec8..5db4638685 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -125,5 +125,20 @@ module ApplicationTests assert_equal expected, c.generators.options end end + + test "api only generators hide assets, helper, js and css namespaces" do + add_to_config <<-RUBY + config.generators.api_only = true + RUBY + + # Initialize the application + require "#{app_path}/config/environment" + Rails.application.load_generators + + assert Rails::Generators.hidden_namespaces.include?("assets") + assert Rails::Generators.hidden_namespaces.include?("helper") + assert Rails::Generators.hidden_namespaces.include?("js") + assert Rails::Generators.hidden_namespaces.include?("css") + end end end -- cgit v1.2.3 From 20939b3fcc3e34850e3c4b47327eff7ccaaa8eba Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 18 Apr 2015 19:53:40 -0400 Subject: config.generators.api_only = true set rails api option on generators --- railties/test/application/generators_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'railties/test/application/generators_test.rb') diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 5db4638685..def57f360b 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -126,7 +126,7 @@ module ApplicationTests end end - test "api only generators hide assets, helper, js and css namespaces" do + test "api only generators hide assets, helper, js and css namespaces and set api option" do add_to_config <<-RUBY config.generators.api_only = true RUBY @@ -139,6 +139,7 @@ module ApplicationTests assert Rails::Generators.hidden_namespaces.include?("helper") assert Rails::Generators.hidden_namespaces.include?("js") assert Rails::Generators.hidden_namespaces.include?("css") + assert Rails::Generators.options[:rails][:api] end end end -- cgit v1.2.3 From 6d2b405a4e4f6e076dfda11438efc5d21b1ff2a2 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 19 Apr 2015 20:23:19 -0400 Subject: Api apps scaffold does not generate views --- railties/test/application/generators_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/test/application/generators_test.rb') 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 -- cgit v1.2.3 From e5b6188b47c811c94b7626a8ec42d946367b3c03 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 19 Apr 2015 21:17:24 -0400 Subject: Api apps scaffold does not generate helpers --- railties/test/application/generators_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/test/application/generators_test.rb') diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 0cca7a50b1..6cb2bfd77b 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_equal false, Rails::Generators.options[:rails][:helper] assert_nil Rails::Generators.options[:rails][:template_engine] end end -- cgit v1.2.3 From 94fdba9c92b233d3f5e9314266aabe51b51bb3e4 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 19 Apr 2015 21:15:39 -0400 Subject: Api apps scaffold does not generate assets --- railties/test/application/generators_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/test/application/generators_test.rb') diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 6cb2bfd77b..36298f2385 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_equal false, Rails::Generators.options[:rails][:assets] assert_equal false, Rails::Generators.options[:rails][:helper] assert_nil Rails::Generators.options[:rails][:template_engine] end -- cgit v1.2.3 From 98a9936228f8a9485131b58a728aaae5ed2dde42 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 20 Apr 2015 12:28:23 -0400 Subject: config.api_only = true implies config.generators.api_only = true --- railties/test/application/generators_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/test/application/generators_test.rb') diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index 36298f2385..ed8daa52fc 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -128,7 +128,7 @@ module ApplicationTests test "api only generators hide assets, helper, js and css namespaces and set api option" do add_to_config <<-RUBY - config.generators.api_only = true + config.api_only = true RUBY # Initialize the application -- cgit v1.2.3 From 7d17269be3ff1427c63b645f50a07c012cad6e4b Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 20 Apr 2015 12:45:46 -0400 Subject: Add test to show api only apps allow overriding generator options --- railties/test/application/generators_test.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'railties/test/application/generators_test.rb') diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index ed8daa52fc..84cc6e120b 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -144,5 +144,21 @@ module ApplicationTests assert_equal false, Rails::Generators.options[:rails][:helper] assert_nil Rails::Generators.options[:rails][:template_engine] end + + test "api only generators allow overriding generator options" do + add_to_config <<-RUBY + config.generators.helper = true + config.api_only = true + config.generators.template_engine = :my_template + RUBY + + # Initialize the application + require "#{app_path}/config/environment" + Rails.application.load_generators + + assert Rails::Generators.options[:rails][:api] + assert Rails::Generators.options[:rails][:helper] + assert_equal :my_template, Rails::Generators.options[:rails][:template_engine] + end end end -- cgit v1.2.3