hot-glue 0.0.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -1
- data/.gitignore +12 -7
- data/Gemfile +4 -9
- data/Gemfile.lock +78 -57
- data/README.md +120 -28
- data/Rakefile +1 -1
- data/app/assets/config/manifest.js +0 -0
- data/bin/rails +2 -2
- data/config/database.yml +11 -0
- data/db/migrate/20210306212711_create_abcs.rb +11 -0
- data/db/migrate/20210306223300_create_defs.rb +9 -0
- data/db/migrate/20210306223305_create_ghis.rb +9 -0
- data/db/migrate/20210306223309_create_jkls.rb +9 -0
- data/db/migrate/20210306223701_devise_create_users.rb +44 -0
- data/db/migrate/20210306225506_create_xyzs.rb +9 -0
- data/db/schema.rb +60 -0
- data/lib/generators/hot_glue/install_generator.rb +3 -3
- data/lib/generators/hot_glue/scaffold_generator.rb +193 -100
- data/lib/generators/hot_glue/templates/_new_form.haml +0 -3
- data/lib/generators/hot_glue/templates/_show.haml +2 -2
- data/lib/generators/hot_glue/templates/{base_controller.rb → base_controller.rb.erb} +0 -0
- data/lib/generators/hot_glue/templates/{controller.rb → controller.rb.erb} +13 -10
- data/lib/generators/hot_glue/templates/edit.haml +2 -0
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +148 -0
- data/lib/generators/hot_glue/templates/update.turbo_stream.haml +4 -0
- data/lib/hotglue/version.rb +1 -1
- metadata +21 -12
- data/lib/generators/hot_glue/templates/controller_spec.rb +0 -110
@@ -5,6 +5,3 @@
|
|
5
5
|
= form_with model: <%= singular %>, url: <%= path_helper_plural %>(<%= nested_objects_arity %>), method: "post" do |f|
|
6
6
|
= render partial: "<%=namespace_with_slash%><%= @plural %>/form", locals: {<%= singular %>: <%= singular %>, f: f}
|
7
7
|
|
8
|
-
.row
|
9
|
-
.col-md-12
|
10
|
-
= f.submit "Save", class: "btn btn-primary pull-right"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= all_line_fields %>
|
2
2
|
.col
|
3
3
|
<% if destroy_action %>
|
4
|
-
= link_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%=
|
4
|
+
= link_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%= path_helper_singular %>(<%= path_helper_args %>), method: :delete, data: {confirm: 'Are you sure?'}, disable_with: "Loading...", class: "delete-<%= singular %>-button btn btn-primary "
|
5
5
|
<% end %>
|
6
6
|
|
7
|
-
= link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%=
|
7
|
+
= link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%= path_helper_singular %>(<%= path_helper_args %>), <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary "
|
File without changes
|
@@ -1,7 +1,6 @@
|
|
1
1
|
class <%= controller_class_name %> < <%= controller_descends_from %>
|
2
2
|
<% unless @auth_identifier == '' || @auth.nil? %>before_action :authenticate_<%= @auth_identifier %>!<% end %>
|
3
|
-
|
4
|
-
before_action :load_<%= arg %><% end %> <% end %>
|
3
|
+
|
5
4
|
before_action :load_<%= singular_name %>, only: [:show, :edit, :update, :destroy]
|
6
5
|
helper :hot_glue
|
7
6
|
include HotGlue::ControllerHelper
|
@@ -11,22 +10,23 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
11
10
|
<% end %>
|
12
11
|
|
13
12
|
<% if any_nested? %><% nest_chain = [] %> <% @nested_args.each { |arg|
|
14
|
-
this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "
|
15
|
-
nest_chain << arg %>
|
16
|
-
|
13
|
+
this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
|
14
|
+
nest_chain << arg %>
|
15
|
+
def <%= arg %>
|
16
|
+
@<%= arg %> ||= <%= this_scope %>.find(params[:<%= arg %>_id])
|
17
17
|
end<% } %><% end %>
|
18
18
|
|
19
19
|
<% if !@self_auth %>
|
20
20
|
def load_<%= singular_name %>
|
21
|
-
@<%= singular_name %> = <%= object_scope %>.find(params[:id])
|
21
|
+
@<%= singular_name %> = <%= object_scope.gsub("@",'') %>.find(params[:id])
|
22
22
|
end
|
23
23
|
<% else %>
|
24
24
|
def load_<%= singular_name %>
|
25
|
-
@<%= singular_name %> = <%= auth_object %>
|
25
|
+
@<%= singular_name %> = <%= auth_object.gsub("@",'') %>
|
26
26
|
end<% end %>
|
27
27
|
|
28
28
|
def load_all_<%= plural %>
|
29
|
-
<% if !@self_auth %>@<%= plural_name %> = <%= object_scope %><% if model_has_strings? %>.where(<%=class_name %>.arel_table[:email].matches("%#{@__general_string}%"))<% end %>.page(params[:page])
|
29
|
+
<% if !@self_auth %>@<%= plural_name %> = <%= object_scope.gsub("@",'') %><% if model_has_strings? %>.where(<%=class_name %>.arel_table[:email].matches("%#{@__general_string}%"))<% end %>.page(params[:page])
|
30
30
|
<% else %>@<%= plural_name %> = [<%= auth_object %>]<% end %>
|
31
31
|
end
|
32
32
|
|
@@ -46,6 +46,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
46
46
|
format.html
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
49
50
|
def create
|
50
51
|
modified_params = modify_date_inputs_on_params(<%=singular_name %>_params.dup<% if !@object_owner_sym.empty? %>.merge!(<%= @object_owner_sym %>: <%= @object_owner_eval %> )<% end %> <%= @auth ? ', ' + @auth : '' %>)
|
51
52
|
@<%=singular_name %> = <%=class_name %>.create(modified_params)
|
@@ -80,8 +81,10 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
80
81
|
end
|
81
82
|
|
82
83
|
def update
|
83
|
-
if
|
84
|
-
|
84
|
+
if @<%= singular_name %>.update(modify_date_inputs_on_params(<%= singular %>_params<%= @auth ? ', ' + @auth : '' %>))
|
85
|
+
flash[:notice] = "Saved #{@<%= singular %>.<%= display_class %>}"
|
86
|
+
else
|
87
|
+
flash[:alert] = "<%= singular_name.titlecase %> could not be saved."
|
85
88
|
end
|
86
89
|
respond_to do |format|
|
87
90
|
format.turbo_stream
|
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe "interaction for <%= controller_class_name %>", type: :feature do
|
4
|
+
include HotGlue::ControllerHelper
|
5
|
+
<% unless @auth.nil? %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
|
6
|
+
|
7
|
+
let!(:<%= singular %>1) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
|
8
|
+
let!(:<%= singular %>2) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
|
9
|
+
let!(:<%= singular %>3) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
|
10
|
+
|
11
|
+
<%= objest_nest_factory_setup %>
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
login_as(<%= @auth %>)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "index" do
|
18
|
+
it "should show me the list" do
|
19
|
+
visit <%= path_helper_plural %>
|
20
|
+
|
21
|
+
<%=
|
22
|
+
@columns.map { |col|
|
23
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
24
|
+
# limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
25
|
+
# sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
|
26
|
+
#
|
27
|
+
|
28
|
+
case type
|
29
|
+
when :datetime
|
30
|
+
" " + ["expect(page).to have_content(#{singular}#{rand(3)+1}.#{col}.in_time_zone(#{ @auth }.timezone).strftime('%m/%d/%Y @ %l:%M %p ').gsub(' ', ' ') + timezonize(#{ @auth }.timezone) )"].join("\n ")
|
31
|
+
|
32
|
+
else
|
33
|
+
" " + ["expect(page).to have_content(#{singular}#{rand(3)+1}.#{col})"].join("\n ")
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
}.join("\n")
|
38
|
+
|
39
|
+
%>
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "new & create" do
|
45
|
+
it "should create a new <%= singular.titlecase %>" do
|
46
|
+
visit <%= path_helper_plural %>
|
47
|
+
click_link "New <%= singular.titlecase %>"
|
48
|
+
expect(page).to have_selector(:xpath, './/h3[contains(., "New <%= singular.titlecase %>")]')
|
49
|
+
|
50
|
+
<%=
|
51
|
+
@columns.map { |col|
|
52
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
53
|
+
# limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
54
|
+
# sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
|
55
|
+
#
|
56
|
+
|
57
|
+
case type
|
58
|
+
when :datetime
|
59
|
+
when :integer
|
60
|
+
" " + 'find("input#' + singular + '_' + col.to_s + '").fill_in(with: rand(10))'
|
61
|
+
else
|
62
|
+
" " + "new_#{col} = 'new_test-email@nowhere.com' \n" +
|
63
|
+
' ' + 'find("input#' + singular + '_' + col.to_s + '").fill_in(with: new_' + col.to_s + ')'
|
64
|
+
end
|
65
|
+
|
66
|
+
}.join("\n")
|
67
|
+
|
68
|
+
%>
|
69
|
+
click_button "Save"
|
70
|
+
expect(page).to have_content("Successfully created")
|
71
|
+
|
72
|
+
<%=
|
73
|
+
@columns.map { |col|
|
74
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
75
|
+
|
76
|
+
case type
|
77
|
+
when :datetime
|
78
|
+
when :integer
|
79
|
+
else
|
80
|
+
"expect(page).to have_content(new_#{col})"
|
81
|
+
end
|
82
|
+
|
83
|
+
}.join("\n")
|
84
|
+
%>
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "show" do
|
90
|
+
it "should return a view form" do
|
91
|
+
visit <%= path_helper_plural %>
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "edit & update" do
|
97
|
+
it "should return an editable form" do
|
98
|
+
visit <%= path_helper_plural %>
|
99
|
+
find("a.edit-<%= singular %>-button[href='/<%= namespace_with_slash %><%= plural %>/#{<%= singular %>1.id}/edit']").click
|
100
|
+
|
101
|
+
expect(page).to have_content("Editing #{<%= singular %>1.<%= derrive_reference_name(singular_class) %>}")
|
102
|
+
<%=
|
103
|
+
@columns.map { |col|
|
104
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
105
|
+
|
106
|
+
case type
|
107
|
+
when :datetime
|
108
|
+
when :integer
|
109
|
+
else
|
110
|
+
" " + "new_#{col.to_s} = Faker::Name.new \n" +
|
111
|
+
|
112
|
+
' find("input[name=\'' + singular + '[' + col.to_s + ']\'").fill_in(with: new_' + col.to_s + ')'
|
113
|
+
|
114
|
+
end
|
115
|
+
}.join("\n")
|
116
|
+
%>
|
117
|
+
click_button "Save"
|
118
|
+
within("turbo-frame#<%= singular %>__#{<%= singular %>1.id} ") do
|
119
|
+
|
120
|
+
|
121
|
+
<%=
|
122
|
+
@columns.map { |col|
|
123
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
124
|
+
case type
|
125
|
+
when :datetime
|
126
|
+
when :integer
|
127
|
+
else
|
128
|
+
' expect(page).to have_content(new_' + col.to_s + ')'
|
129
|
+
end
|
130
|
+
}.join("\n")
|
131
|
+
%>
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe "destroy" do
|
138
|
+
it "should destroy" do
|
139
|
+
visit <%= path_helper_plural %>
|
140
|
+
accept_alert do
|
141
|
+
find("a.delete-<%= singular %>-button[href='<%= namespace_with_dash %>/<%= plural %>/#{<%= singular %>1.id}']").click
|
142
|
+
end
|
143
|
+
expect(page).to_not have_content(<%= singular %>1.email)
|
144
|
+
expect(<%= singular_class %>.where(id: <%= singular %>1.id).count).to eq(0)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
@@ -3,3 +3,7 @@
|
|
3
3
|
= render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nested_assignments_with_leading_comma %> }
|
4
4
|
|
5
5
|
|
6
|
+
= turbo_stream.replace "flash_notices" do
|
7
|
+
= render partial: "layouts/flash_notices"
|
8
|
+
- if @<%= singular %>.errors.any?
|
9
|
+
= render partial: "errors", locals: {resource: @<%= singular %>}
|
data/lib/hotglue/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hot-glue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Fleetwood-Boldt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -108,9 +108,18 @@ files:
|
|
108
108
|
- LICENCE
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
|
+
- app/assets/config/manifest.js
|
111
112
|
- app/helpers/hot_glue/controller_helper.rb
|
112
113
|
- app/helpers/hot_glue_helper.rb
|
113
114
|
- bin/rails
|
115
|
+
- config/database.yml
|
116
|
+
- db/migrate/20210306212711_create_abcs.rb
|
117
|
+
- db/migrate/20210306223300_create_defs.rb
|
118
|
+
- db/migrate/20210306223305_create_ghis.rb
|
119
|
+
- db/migrate/20210306223309_create_jkls.rb
|
120
|
+
- db/migrate/20210306223701_devise_create_users.rb
|
121
|
+
- db/migrate/20210306225506_create_xyzs.rb
|
122
|
+
- db/schema.rb
|
114
123
|
- lib/generators/hot_glue/install_generator.rb
|
115
124
|
- lib/generators/hot_glue/scaffold_generator.rb
|
116
125
|
- lib/generators/hot_glue/templates/_errors.haml
|
@@ -121,15 +130,15 @@ files:
|
|
121
130
|
- lib/generators/hot_glue/templates/_new_button.haml
|
122
131
|
- lib/generators/hot_glue/templates/_new_form.haml
|
123
132
|
- lib/generators/hot_glue/templates/_show.haml
|
124
|
-
- lib/generators/hot_glue/templates/base_controller.rb
|
125
|
-
- lib/generators/hot_glue/templates/controller.rb
|
126
|
-
- lib/generators/hot_glue/templates/controller_spec.rb
|
133
|
+
- lib/generators/hot_glue/templates/base_controller.rb.erb
|
134
|
+
- lib/generators/hot_glue/templates/controller.rb.erb
|
127
135
|
- lib/generators/hot_glue/templates/create.turbo_stream.haml
|
128
136
|
- lib/generators/hot_glue/templates/destroy.turbo_stream.haml
|
129
137
|
- lib/generators/hot_glue/templates/edit.haml
|
130
138
|
- lib/generators/hot_glue/templates/edit.turbo_stream.haml
|
131
139
|
- lib/generators/hot_glue/templates/index.haml
|
132
140
|
- lib/generators/hot_glue/templates/new.haml
|
141
|
+
- lib/generators/hot_glue/templates/system_spec.rb.erb
|
133
142
|
- lib/generators/hot_glue/templates/update.turbo_stream.haml
|
134
143
|
- lib/hot-glue.rb
|
135
144
|
- lib/hotglue/engine.rb
|
@@ -139,8 +148,8 @@ licenses:
|
|
139
148
|
- Nonstandard
|
140
149
|
metadata:
|
141
150
|
source_code_uri: https://github.com/jasonfb/hot-glue
|
142
|
-
documentation_uri: https://
|
143
|
-
homepage_uri: https://
|
151
|
+
documentation_uri: https://www.instagram.com/jfbcodes/
|
152
|
+
homepage_uri: https://jasonfleetwoodboldt.com/hot-glue/
|
144
153
|
post_install_message: |
|
145
154
|
---------------------------------------------
|
146
155
|
Welcome to Hot Glue - A Scaffold Building Companion for Hotwire + Turbo-Rails
|
@@ -149,11 +158,11 @@ post_install_message: |
|
|
149
158
|
|
150
159
|
* Build plug-and-play scaffolding mixing HAML with the power of Hotwire and Turbo-Rails
|
151
160
|
* Automatically Reads Your Models (make them before building your scaffolding!)
|
152
|
-
* Excellent for CRUD, lists with pagination
|
153
|
-
* Great for prototyping
|
154
|
-
* Plays nicely with Devise, Kaminari, Haml-Rails, Rspec
|
155
|
-
* Create specs automatically along with the controllers.
|
156
|
-
* Nest your routes model-by-model for built-in poor man's authentication
|
161
|
+
* Excellent for CRUD, lists with pagination (coming soon: searching & sorting)
|
162
|
+
* Great for prototyping.
|
163
|
+
* Plays nicely with Devise, Kaminari, Haml-Rails, Rspec, FontAwesome
|
164
|
+
* Create specs automatically along with the generated controllers.
|
165
|
+
* Nest your routes model-by-model for built-in poor man's authentication.
|
157
166
|
* Throw the scaffolding away when your app is ready to graduate to its next phase.
|
158
167
|
|
159
168
|
see README for complete instructions.
|
@@ -1,110 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
describe <%= controller_class_name %> do
|
4
|
-
render_views
|
5
|
-
<% unless @auth.nil? %> let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
|
6
|
-
let(:<%= singular %>) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> )}
|
7
|
-
|
8
|
-
<%= objest_nest_factory_setup %>
|
9
|
-
|
10
|
-
before(:each) do
|
11
|
-
@request.env["devise.mapping"] = Devise.mappings[:account]
|
12
|
-
|
13
|
-
sign_in <%= @auth %>, scope: :<%= @auth %>
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "index" do
|
17
|
-
it "should respond" do
|
18
|
-
get :index, xhr: true, format: 'js', params: {
|
19
|
-
<%= objest_nest_params_by_id_for_specs %>
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "new" do
|
25
|
-
it "should show form" do
|
26
|
-
get :new, xhr: true, format: 'js', params: {
|
27
|
-
<%= objest_nest_params_by_id_for_specs %>
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "create" do
|
33
|
-
it "should create a new <%= singular %>" do
|
34
|
-
expect {
|
35
|
-
post :create, xhr: true, format: 'js', params: {
|
36
|
-
<%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
|
37
|
-
<%= singular %>: {
|
38
|
-
<%= columns_spec_with_sample_data %>
|
39
|
-
}}
|
40
|
-
}.to change { <%= @singular_class %>.all.count }.by(1)
|
41
|
-
assert_response :ok
|
42
|
-
end
|
43
|
-
|
44
|
-
# it "should not create if there are errors" do
|
45
|
-
# post :create, xhr: true, format: 'js', params: {id: <%= singular %>.id,
|
46
|
-
# <%= singular %>: {skin_id: nil}}
|
47
|
-
#
|
48
|
-
# expect(controller).to set_flash.now[:alert].to(/Oops, your <%= singular %> could not be saved/)
|
49
|
-
# end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "edit" do
|
53
|
-
it "should return an editable form" do
|
54
|
-
get :edit, xhr: true, format: 'js', params: {
|
55
|
-
<%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
|
56
|
-
id: <%= singular %>.id
|
57
|
-
}
|
58
|
-
assert_response :ok
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "show" do
|
63
|
-
it "should return a view form" do
|
64
|
-
get :show, xhr: true, format: 'js', params: {
|
65
|
-
<%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
|
66
|
-
id: <%= singular %>.id
|
67
|
-
}
|
68
|
-
assert_response :ok
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "update" do
|
73
|
-
it "should update" do
|
74
|
-
put :update, xhr: true, format: 'js',
|
75
|
-
params: {
|
76
|
-
<%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
|
77
|
-
id: <%= singular %>.id,
|
78
|
-
<%= singular %>: {
|
79
|
-
<%= columns_spec_with_sample_data %>
|
80
|
-
}}
|
81
|
-
|
82
|
-
assert_response :ok
|
83
|
-
end
|
84
|
-
|
85
|
-
# it "should not update if invalid" do
|
86
|
-
# put :update, xhr: true, format: 'js',
|
87
|
-
# params: {
|
88
|
-
# id: <%= singular %>.id,
|
89
|
-
# <%= singular %>: {
|
90
|
-
# <%= columns_spec_with_sample_data %>
|
91
|
-
# }}
|
92
|
-
#
|
93
|
-
# assert_response :ok
|
94
|
-
#
|
95
|
-
# expect(controller).to set_flash.now[:alert].to(/Oops, your <%= singular %> could not be saved/)
|
96
|
-
# end
|
97
|
-
end
|
98
|
-
|
99
|
-
describe "#destroy" do
|
100
|
-
it "should destroy" do
|
101
|
-
post :destroy, format: 'js', params: {
|
102
|
-
<%= (@nested_args.empty? ? "" : objest_nest_params_by_id_for_specs + ",") %>
|
103
|
-
id: <%= singular %>.id
|
104
|
-
}
|
105
|
-
assert_response :ok
|
106
|
-
expect(<%= @singular_class %>.count).to be(0)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|