Commit 00a43072 by liyijie

Fix auth spec template

parent 9be52c63
...@@ -52,6 +52,10 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase ...@@ -52,6 +52,10 @@ class SimpleControllerGenerator < Rails::Generators::NamedBase
options.auth&.camelcase if options.auth.present? options.auth&.camelcase if options.auth.present?
end end
def auth_singular
options.auth
end
def response_status action def response_status action
case action case action
when 'get' when 'get'
......
...@@ -18,7 +18,7 @@ RSpec.describe '<%= controller_path %>', type: :request, capture_examples: true, ...@@ -18,7 +18,7 @@ RSpec.describe '<%= controller_path %>', type: :request, capture_examples: true,
before :each do before :each do
<% if auth.present? -%> <% if auth.present? -%>
@<%= resource_singular %> = <%= auth %>.register "auth", "password" @<%= auth_singular %> = <%= auth %>.register "auth", "password"
@auth_token = <%= auth %>.login "auth", "password" @auth_token = <%= auth %>.login "auth", "password"
<% end -%> <% end -%>
@entity_count = 5 @entity_count = 5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment