Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simple_controller
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
simple_controller
Commits
69cd4b4a
Commit
69cd4b4a
authored
Dec 23, 2018
by
liyijie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rspec template format error
parent
d0436922
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
spec.rb.tt
lib/generators/simple_controller/templates/specs/spec.rb.tt
+11
-11
No files found.
lib/generators/simple_controller/templates/specs/spec.rb.tt
View file @
69cd4b4a
...
...
@@ -5,11 +5,11 @@ RSpec.describe '<%= controller_path %>', type: :request, capture_examples: true,
type: :object, properties: {
<%= resource_singular %>: {
type: :object, properties: {
<% if resource_class&.columns_hash.present? -%>
<% resource_class.columns_hash.except('id', 'created_at', 'updated_at').values.each do |column| -%>
<%= column.name %>: { type: :<%= column.type %>, description: '' },
<% end -%>
<% end -%>
<%
-
if resource_class&.columns_hash.present? -%>
<%
-
resource_class.columns_hash.except('id', 'created_at', 'updated_at').values.each do |column| -%>
<%= column.name %>: { type: :<%= column.type %>, description: '
<%= column&.comment %>
' },
<%
-
end -%>
<%
-
end -%>
}
}
}
...
...
@@ -18,11 +18,11 @@ RSpec.describe '<%= controller_path %>', type: :request, capture_examples: true,
before :each do
<% if auth.present? -%>
@<%= auth_singular %> = <%= auth %>.register "
auth
", "password"
@
auth_token = <%= auth %>.login "auth
", "password"
@<%= auth_singular %> = <%= auth %>.register "
<%= auth_singular %>
", "password"
@
"<%= auth_singular %>"_token = <%= auth %>.login "<%= auth_singular %>
", "password"
<% end -%>
@
entity
_count = 5
@<%= resource_plural %> = FactoryBot.create_list(:<%= resource_singular %>, @
entity
_count)
@
<%= resource_singular %>
_count = 5
@<%= resource_plural %> = FactoryBot.create_list(:<%= resource_singular %>, @
<%= resource_singular %>
_count)
end
<% @routes.each do | template, path_item | -%>
...
...
@@ -69,11 +69,11 @@ resource_singular %>_ref
<% elsif details[:summary].start_with?("list") -%>
it {
body = JSON.parse(response.body)
expect(body['<%= resource_plural %>'].count).to eq @
entity
_count
expect(body['<%= resource_plural %>'].count).to eq @
<%= resource_singular %>
_count
}
<% elsif details[:summary].start_with?("delete") -%>
it {
expect(<%= resource_class %>.count).to eq(@
entity
_count-1)
expect(<%= resource_class %>.count).to eq(@
<%= resource_singular %>
_count-1)
}
<% elsif details[:summary].start_with?("show") -%>
it {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment