diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-08-09 21:01:56 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2015-08-09 21:32:39 +0900 |
commit | 22d863d272eea25eaa391c07532e4f1279c46721 (patch) | |
tree | 5714bab23a74e4714c43318331177e87dfe649cc /railties/lib | |
parent | 378e3a666e9ed6b0fb037a1082ff0b13b850acaa (diff) | |
download | rails-22d863d272eea25eaa391c07532e4f1279c46721.tar.gz rails-22d863d272eea25eaa391c07532e4f1279c46721.tar.bz2 rails-22d863d272eea25eaa391c07532e4f1279c46721.zip |
make generated scaffold functional tests work inside API engines
* set engine's route in setup
* use fixture with engine namespace
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb index 896b38bc8f..f302cd6c3d 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb @@ -3,7 +3,10 @@ require 'test_helper' <% module_namespacing do -%> class <%= controller_class_name %>ControllerTest < ActionController::TestCase setup do - @<%= singular_table_name %> = <%= table_name %>(:one) + @<%= singular_table_name %> = <%= fixture_name %>(:one) +<% if mountable_engine? -%> + @routes = Engine.routes +<% end -%> end test "should get index" do |