hot-glue 0.0.9 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +21 -18
  3. data/README.md +83 -50
  4. data/app/helpers/hot_glue/controller_helper.rb +1 -1
  5. data/db/migrate/20210306223305_create_ghis.rb +9 -0
  6. data/db/schema.rb +1 -1
  7. data/lib/generators/hot_glue/install_generator.rb +0 -2
  8. data/lib/generators/hot_glue/markup_templates/base.rb +7 -0
  9. data/lib/generators/hot_glue/markup_templates/erb.rb +228 -0
  10. data/lib/generators/hot_glue/markup_templates/haml.rb +223 -0
  11. data/lib/generators/hot_glue/markup_templates/slim.rb +9 -0
  12. data/lib/generators/hot_glue/scaffold_generator.rb +162 -265
  13. data/lib/generators/hot_glue/templates/controller.rb.erb +24 -10
  14. data/lib/generators/hot_glue/templates/erb/_errors.erb +11 -0
  15. data/lib/generators/hot_glue/templates/erb/_flash_notices.erb +12 -0
  16. data/lib/generators/hot_glue/templates/erb/_form.erb +8 -0
  17. data/lib/generators/hot_glue/templates/erb/_line.erb +10 -0
  18. data/lib/generators/hot_glue/templates/erb/_list.erb +19 -0
  19. data/lib/generators/hot_glue/templates/erb/_new_button.erb +3 -0
  20. data/lib/generators/hot_glue/templates/erb/_new_form.erb +8 -0
  21. data/lib/generators/hot_glue/templates/erb/_show.erb +8 -0
  22. data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +18 -0
  23. data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +3 -0
  24. data/lib/generators/hot_glue/templates/erb/edit.erb +30 -0
  25. data/lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb +3 -0
  26. data/lib/generators/hot_glue/templates/erb/index.erb +10 -0
  27. data/lib/generators/hot_glue/templates/erb/new.erb +1 -0
  28. data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +10 -0
  29. data/lib/generators/hot_glue/templates/{_errors.haml → haml/_errors.haml} +0 -0
  30. data/lib/generators/hot_glue/templates/{_flash_notices.haml → haml/_flash_notices.haml} +0 -0
  31. data/lib/generators/hot_glue/templates/{_form.haml → haml/_form.haml} +1 -0
  32. data/lib/generators/hot_glue/templates/{_line.haml → haml/_line.haml} +0 -0
  33. data/lib/generators/hot_glue/templates/{_list.haml → haml/_list.haml} +0 -0
  34. data/lib/generators/hot_glue/templates/{_new_button.haml → haml/_new_button.haml} +0 -0
  35. data/lib/generators/hot_glue/templates/{_new_form.haml → haml/_new_form.haml} +0 -3
  36. data/lib/generators/hot_glue/templates/haml/_show.haml +7 -0
  37. data/lib/generators/hot_glue/templates/{create.turbo_stream.haml → haml/create.turbo_stream.haml} +0 -0
  38. data/lib/generators/hot_glue/templates/{destroy.turbo_stream.haml → haml/destroy.turbo_stream.haml} +0 -0
  39. data/lib/generators/hot_glue/templates/{edit.haml → haml/edit.haml} +0 -0
  40. data/lib/generators/hot_glue/templates/{edit.turbo_stream.haml → haml/edit.turbo_stream.haml} +0 -0
  41. data/lib/generators/hot_glue/templates/{index.haml → haml/index.haml} +0 -0
  42. data/lib/generators/hot_glue/templates/{new.haml → haml/new.haml} +0 -0
  43. data/lib/generators/hot_glue/templates/haml/update.turbo_stream.haml +9 -0
  44. data/lib/generators/hot_glue/templates/system_spec.rb.erb +109 -14
  45. data/lib/hot-glue.rb +6 -20
  46. data/lib/hotglue/version.rb +1 -1
  47. metadata +38 -20
  48. data/db/migrate/20210306223305_create_hgis.rb +0 -9
  49. data/lib/generators/hot_glue/templates/_show.haml +0 -7
  50. data/lib/generators/hot_glue/templates/request_spec.rb.erb +0 -110
  51. data/lib/generators/hot_glue/templates/update.turbo_stream.haml +0 -5
@@ -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
-
@@ -1,5 +0,0 @@
1
-
2
- = turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do
3
- = render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nested_assignments_with_leading_comma %> }
4
-
5
-