hot-glue 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +34 -2
- data/app/helpers/hot_glue/controller_helper.rb +6 -4
- data/lib/generators/hot_glue/install_generator.rb +27 -0
- data/lib/generators/hot_glue/markup_templates/erb.rb +19 -7
- data/lib/generators/hot_glue/scaffold_generator.rb +1 -1
- data/lib/generators/hot_glue/templates/controller.rb.erb +2 -2
- data/lib/generators/hot_glue/templates/erb/edit.erb +1 -8
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +133 -45
- data/lib/hotglue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31420297af512f9e5153ff91ff0b15baec2650080938b9a1def230de42dae0a3
|
4
|
+
data.tar.gz: cf430cad34867b7113f48a56e06b7b195a476ae1090da28f06796b10a7eccf94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ccaa42b5ab50ca222ff8c437bc348ab0f40d3c9d9c70f130ff47c2b8fea4ad51e267d6d21a377aa1f9d0bd47493a12b85296ce7b9e49081bd4ea841200ea54
|
7
|
+
data.tar.gz: b64d5bd42d2f571e4a1297b36fcdebe5d65907f63ab87c9f906fcf9576b223ab434e7348023bdd91a5f84ef517cd3576ba2e97ad0ae0f2dcfe108d93a6df2bf0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hot-glue (0.2.
|
4
|
+
hot-glue (0.2.4)
|
5
5
|
ffaker (~> 2.16)
|
6
6
|
haml-rails (~> 2.0)
|
7
7
|
kaminari (~> 1.2)
|
@@ -91,7 +91,7 @@ GEM
|
|
91
91
|
diff-lcs (1.4.4)
|
92
92
|
erubi (1.10.0)
|
93
93
|
erubis (2.7.0)
|
94
|
-
ffaker (2.
|
94
|
+
ffaker (2.20.0)
|
95
95
|
ffi (1.15.4)
|
96
96
|
globalid (0.4.2)
|
97
97
|
activesupport (>= 4.2.0)
|
data/README.md
CHANGED
@@ -105,6 +105,11 @@ FOR HAML:
|
|
105
105
|
## Rspec setup
|
106
106
|
- add `gem 'rspec-rails'` to your gemfile inside :development and :test
|
107
107
|
- add `gem 'factory_bot_rails'` to your gemfile inside :development and :test
|
108
|
+
- more info:
|
109
|
+
https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#rspec
|
110
|
+
|
111
|
+
- add `gem 'ffaker'` to your Gemfile inside the :development and :test groups
|
112
|
+
-
|
108
113
|
- run `rails generate rspec:install`
|
109
114
|
- configure Rspec to work with Factory Bot inside of `rails_helper.rb`
|
110
115
|
```
|
@@ -113,8 +118,29 @@ FOR HAML:
|
|
113
118
|
config.include FactoryBot::Syntax::Methods
|
114
119
|
end
|
115
120
|
```
|
116
|
-
|
117
|
-
|
121
|
+
|
122
|
+
- add to rails_helper.rb (inside the existing Rspec.configure block)
|
123
|
+
- ````
|
124
|
+
config.include FactoryBot::Syntax::Methods
|
125
|
+
````
|
126
|
+
- also add to rails_helper.rb (outside of the Rspec.configure block)
|
127
|
+
```
|
128
|
+
Capybara.register_driver :headless_chrome_desktop do |app|
|
129
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
130
|
+
options.add_argument('--headless')
|
131
|
+
options.add_argument('--disable-gpu')
|
132
|
+
options.add_argument('--window-size=1280,1200')
|
133
|
+
|
134
|
+
driver = Capybara::Selenium::Driver.new(app,
|
135
|
+
browser: :chrome,
|
136
|
+
options: options)
|
137
|
+
|
138
|
+
driver
|
139
|
+
end
|
140
|
+
Capybara.default_driver = :headless_chrome_desktop
|
141
|
+
|
142
|
+
```
|
143
|
+
|
118
144
|
|
119
145
|
- for a quick Capybara login, create a support helper in `spec/support/` and log-in as your user
|
120
146
|
```
|
@@ -466,6 +492,12 @@ Obviously, the created controller will always have this base controller as its s
|
|
466
492
|
|
467
493
|
# VERSION HISTORY
|
468
494
|
|
495
|
+
#### 2021-10-09 - v-0.2.5 - this version is all about developer happyness:
|
496
|
+
- significant fixes for the behavioral (system) specs. they now create new & update interactions
|
497
|
+
for (almost) all field types
|
498
|
+
- the install generator now checks your layouts/application.html.erb for `render partial: 'layouts/flash_messages' ` and adds it if it isn't there already
|
499
|
+
- the install generator also checks your spec/rails_helper for `config.include FactoryBot::Syntax::Methods` and adds it at the top of the Rspec configure block if it isn't there
|
500
|
+
|
469
501
|
#### 2021-10-07 - v0.2.4 - removes erroneous icons display in delete buttos (these don't work inside of button_to);
|
470
502
|
- adds support for ENUM types direclty on your field types
|
471
503
|
- you must use activerecord-pgenum
|
@@ -54,10 +54,12 @@ module HotGlue
|
|
54
54
|
else
|
55
55
|
server_timezone
|
56
56
|
end
|
57
|
-
elsif
|
58
|
-
|
59
|
-
elsif
|
60
|
-
|
57
|
+
elsif true
|
58
|
+
server_timezone
|
59
|
+
# elsif defined?(controller) == "method"
|
60
|
+
# # controller.try(:current_timezone)
|
61
|
+
# elsif self.class.ancestors.include?(ApplicationController)
|
62
|
+
# self.try(:current_timezone)
|
61
63
|
else
|
62
64
|
raise "no method current_user is available; please implement/override the method current_timezone IN YOUR CONTROLLER"
|
63
65
|
end
|
@@ -21,8 +21,35 @@ module HotGlue
|
|
21
21
|
|
22
22
|
if Rails.version.split(".")[0].to_i >= 7
|
23
23
|
copy_file "confirmable.js", "#{'spec/dummy/' if Rails.env.test?}app/javascript/controllers/confirmable.js"
|
24
|
+
end
|
25
|
+
|
26
|
+
rails_helper_contents = File.read("spec/rails_helper.rb")
|
27
|
+
if !rails_helper_contents.include?("include FactoryBot::Syntax::Methods")
|
28
|
+
rails_helper_contents.gsub!("RSpec.configure do |config|", "RSpec.configure do |config| \n
|
29
|
+
config.include FactoryBot::Syntax::Methods
|
30
|
+
")
|
31
|
+
File.write("spec/rails_helper.rb", rails_helper_contents)
|
32
|
+
puts " HOTGLUE --> add to spec/rails_helper.rb: `config.include FactoryBot::Syntax::Methods` "
|
33
|
+
end
|
34
|
+
|
35
|
+
application_layout_contents = File.read("app/views/layouts/application.html.erb")
|
24
36
|
|
37
|
+
if !application_layout_contents.include?("render partial: 'layouts/flash_notices'")
|
38
|
+
application_layout_contents.gsub!("<body>", "<body>\n
|
39
|
+
<%= render partial: 'flash_notices' %>
|
40
|
+
")
|
41
|
+
File.write("app/views/layouts/application.html.erb", application_layout_contents)
|
42
|
+
puts " HOTGLUE --> add to app/views/layouts/application.html.erb: `<%= render partial: 'layouts/flash_notices' %>` "
|
25
43
|
end
|
44
|
+
|
45
|
+
#
|
46
|
+
|
47
|
+
# TODO>: look for config.include FactoryBot::Syntax::Methods
|
48
|
+
# inside of spec/rails_Helper.rb and inject it if it is not there
|
49
|
+
# rspec_file = File.read("spec/rails_helper.rb")
|
50
|
+
#
|
51
|
+
# "RSpec.configure do |config|"
|
52
|
+
|
26
53
|
end
|
27
54
|
end
|
28
55
|
end
|
@@ -11,6 +11,20 @@ module HotGlue
|
|
11
11
|
"</div>"
|
12
12
|
end
|
13
13
|
|
14
|
+
|
15
|
+
def text_area_output(col, field_length, col_identifier )
|
16
|
+
lines = field_length % 40
|
17
|
+
if lines > 5
|
18
|
+
lines = 5
|
19
|
+
end
|
20
|
+
|
21
|
+
"<div class=\"#{col_identifier} form-group \#{'alert-danger' if #{singular}.errors.details.keys.include?(:#{col.to_s})}\">" +
|
22
|
+
"<%= f.text_area :#{col.to_s}, class: 'form-control', cols: 40, rows: '#{lines}' %>" +
|
23
|
+
"<label class='form-text'>#{col.to_s.humanize}</label>"+
|
24
|
+
"</div>"
|
25
|
+
|
26
|
+
end
|
27
|
+
|
14
28
|
def list_column_headings(*args)
|
15
29
|
columns = args[0][:columns]
|
16
30
|
|
@@ -70,19 +84,17 @@ module HotGlue
|
|
70
84
|
|
71
85
|
end
|
72
86
|
when :string
|
73
|
-
|
74
|
-
|
75
|
-
field_output(col, nil, limit, col_identifier)
|
87
|
+
if sql_type == "varchar" || sql_type == "character varying"
|
88
|
+
field_output(col, nil, limit || 40, col_identifier)
|
76
89
|
else
|
77
|
-
text_area_output(col,
|
90
|
+
text_area_output(col, 65536, col_identifier)
|
78
91
|
end
|
79
92
|
|
80
93
|
when :text
|
81
|
-
|
82
|
-
if limit <= 256
|
94
|
+
if sql_type == "varchar"
|
83
95
|
field_output(col, nil, limit, col_identifier)
|
84
96
|
else
|
85
|
-
text_area_output(col,
|
97
|
+
text_area_output(col, 65536, col_identifier)
|
86
98
|
end
|
87
99
|
when :float
|
88
100
|
limit ||= 256
|
@@ -106,7 +106,7 @@ module HotGlue
|
|
106
106
|
@singular = args.first.tableize.singularize # should be in form hello_world
|
107
107
|
@plural = options['plural'] || @singular + "s" # supply to override; leave blank to use default
|
108
108
|
@auth = options['auth'] || "current_user"
|
109
|
-
@auth_identifier = options['auth_identifier'] || (
|
109
|
+
@auth_identifier = options['auth_identifier'] || (! @god && @auth.gsub("current_", "")) || nil
|
110
110
|
|
111
111
|
|
112
112
|
@nest = (!options['nest'].empty? && options['nest']) || nil
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class <%= controller_class_name %> < <%= controller_descends_from %>
|
2
|
-
<% unless @auth_identifier == '' || @
|
2
|
+
<% unless @auth_identifier == '' || @god %>before_action :authenticate_<%= @auth_identifier %>!<% end %>
|
3
3
|
|
4
4
|
<% if any_nested? %><% nest_chain = [] %> <% @nested_args.each { |arg|
|
5
5
|
this_scope = nest_chain.empty? ? "#{@auth ? auth_object : class_name}.#{arg}s" : "#{nest_chain.last}.#{arg}s"
|
@@ -49,7 +49,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
<% if create_action %> def new <% if
|
52
|
+
<% if create_action %> def new <% if ! @god %>
|
53
53
|
@<%= singular_name %> = <%= class_name %>.new(<%= @object_owner_sym %>: <%= @object_owner_eval %>)
|
54
54
|
<% else %>
|
55
55
|
@<%= singular_name %> = <%= class_name %>.new
|
@@ -8,14 +8,7 @@
|
|
8
8
|
<\%= render(partial: "#{controller.namespace}errors", locals: {resource: @<%= singular%> }) %>
|
9
9
|
<\% end %>
|
10
10
|
|
11
|
-
<h2>Editing
|
12
|
-
<% if eval("@" + singular).try(:to_label) %>
|
13
|
-
<%="@" + singular%>.to_label
|
14
|
-
<% elsif eval("@" + singular).try(:name) %>
|
15
|
-
<%="@" + singular%>.name %>
|
16
|
-
<% else %>
|
17
|
-
(no name)
|
18
|
-
<% end %>
|
11
|
+
<h2>Editing <\%= @<%= @singular %>.<%= display_class %> %></h2>
|
19
12
|
<\%= form_with model: <%= "@" + singular%>, url: <%= path_helper_singular %>(<%= path_arity %>) do |f| %>
|
20
13
|
<\%= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f} %>
|
21
14
|
<\% end %>
|
@@ -2,42 +2,73 @@ require 'rails_helper'
|
|
2
2
|
|
3
3
|
describe "interaction for <%= controller_class_name %>", type: :feature do
|
4
4
|
include HotGlue::ControllerHelper
|
5
|
-
<% unless @
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
<% unless @god %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
|
6
|
+
<%= @columns.map { |col|
|
7
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
8
|
+
case type
|
9
|
+
when :integer
|
10
|
+
if col.to_s.ends_with?("_id")
|
11
|
+
assoc = "#{col.to_s.gsub('_id','')}"
|
12
|
+
"let!(:#{assoc}1) {create(:#{assoc}, name: FFaker::Name.name)}"
|
13
|
+
end
|
14
|
+
else
|
15
|
+
end
|
16
|
+
}.compact.join("\n")
|
17
|
+
%>
|
18
|
+
<% item1_addOns = ""
|
19
|
+
if (eval(@singular_class).instance_methods.include?(display_class.to_s))
|
20
|
+
item1_addOns << "#{display_class}: FFaker::Name.name"
|
21
|
+
end
|
22
|
+
|
23
|
+
item1_addOns << ", " + @columns.map { |col|
|
24
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
25
|
+
case type
|
26
|
+
when :string
|
27
|
+
"#{col}: FFaker::Movie.title"
|
28
|
+
when :text
|
29
|
+
"#{col}: FFaker::Lorem.paragraphs(10).join(" ")"
|
30
|
+
|
31
|
+
when :float
|
32
|
+
"#{col}: rand(1)*10000"
|
33
|
+
when :boolean
|
34
|
+
"#{col}: !!rand(2).floor"
|
35
|
+
when :time
|
36
|
+
"#{col}: Time.current + rand(5000).seconds"
|
37
|
+
when :date
|
38
|
+
"#{col}: Date.current + rand(50).days"
|
39
|
+
when :datetime
|
40
|
+
"#{col}: DateTime.current + rand(1000).seconds"
|
41
|
+
when :integer
|
42
|
+
if col.to_s.ends_with?("_id")
|
43
|
+
# shoould the assoication be on here
|
44
|
+
else
|
45
|
+
"#{col}: rand(100)"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
}.compact.join(", \n ")
|
49
|
+
%>let!(:<%= singular %>1) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> <%= item1_addOns %> )}
|
50
|
+
<%= objest_nest_factory_setup %> <% unless @god %>
|
13
51
|
before(:each) do
|
14
52
|
login_as(<%= @auth %>)
|
15
|
-
end
|
53
|
+
end <% end %>
|
16
54
|
|
17
55
|
describe "index" do
|
18
56
|
it "should show me the list" do
|
19
57
|
visit <%= path_helper_plural %>
|
20
|
-
|
21
58
|
<%=
|
22
59
|
@columns.map { |col|
|
23
60
|
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
61
|
case type
|
29
62
|
when :datetime
|
30
|
-
" " + ["expect(page).to have_content(#{singular}#{
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
63
|
+
" " + ["expect(page).to have_content(#{singular}#{1}.#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y @ %l:%M %p ').gsub(' ', ' ') + timezonize(current_timezone) )"].join("\n ")
|
64
|
+
when :integer
|
65
|
+
if !col.ends_with?("_id")
|
66
|
+
" " + ["expect(page).to have_content(#{singular}#{1}.#{col})"].join("\n ")
|
67
|
+
end
|
35
68
|
end
|
36
69
|
|
37
70
|
}.join("\n")
|
38
|
-
|
39
71
|
%>
|
40
|
-
|
41
72
|
end
|
42
73
|
end
|
43
74
|
|
@@ -50,17 +81,28 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
50
81
|
<%=
|
51
82
|
@columns.map { |col|
|
52
83
|
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
84
|
case type
|
58
85
|
when :datetime
|
86
|
+
" " + "new_#{col} = DateTime.current + (rand(100).days) \n" +
|
87
|
+
' ' + "find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
88
|
+
|
59
89
|
when :integer
|
60
|
-
|
90
|
+
|
91
|
+
if col.to_s.ends_with?("_id")
|
92
|
+
assoc = col.to_s.gsub('_id','')
|
93
|
+
" #{col}_selector = find(\"[name='#{singular}[#{col}]']\").click \n" +
|
94
|
+
" #{col}_selector.first('option', text: #{assoc}1.name).select_option"
|
95
|
+
else
|
96
|
+
" new_#{col} = rand(10) \n" +
|
97
|
+
" find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
98
|
+
|
99
|
+
end
|
100
|
+
when :boolean
|
101
|
+
" new_#{col} = rand(2).floor \n" +
|
102
|
+
" find(\"[name='#{singular}[#{col}]'][value='\#{new_" + col.to_s + "}']\").choose"
|
61
103
|
else
|
62
104
|
" " + "new_#{col} = 'new_test-email@nowhere.com' \n" +
|
63
|
-
|
105
|
+
" find(\"[name='#{singular}[#{ col.to_s }]']\").fill_in(with: new_#{col.to_s})"
|
64
106
|
end
|
65
107
|
|
66
108
|
}.join("\n")
|
@@ -75,41 +117,77 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
75
117
|
|
76
118
|
case type
|
77
119
|
when :datetime
|
120
|
+
" expect(page).to have_content(new_#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y') + \" @ \" +
|
121
|
+
new_#{col}.in_time_zone(current_timezone).strftime('%l').strip + \":\" +
|
122
|
+
new_#{col}.in_time_zone(current_timezone).strftime('%M %p').strip + \" \" +
|
123
|
+
timezonize(current_timezone))"
|
78
124
|
when :integer
|
125
|
+
if col.to_s.ends_with?("_id")
|
126
|
+
# shoould the assoication be on here
|
127
|
+
else
|
128
|
+
"expect(page).to have_content(new_#{col})"
|
129
|
+
end
|
79
130
|
else
|
80
131
|
"expect(page).to have_content(new_#{col})"
|
81
132
|
end
|
82
133
|
|
83
|
-
}.join("\n")
|
134
|
+
}.compact.join("\n ")
|
84
135
|
%>
|
85
136
|
|
86
137
|
end
|
87
138
|
end
|
88
139
|
|
89
|
-
describe "show" do
|
90
|
-
it "should return a view form" do
|
91
|
-
visit <%= path_helper_plural %>
|
92
|
-
|
93
|
-
end
|
94
|
-
end
|
95
140
|
|
96
141
|
describe "edit & update" do
|
97
142
|
it "should return an editable form" do
|
98
143
|
visit <%= path_helper_plural %>
|
99
144
|
find("a.edit-<%= singular %>-button[href='/<%= namespace_with_slash %><%= plural %>/#{<%= singular %>1.id}/edit']").click
|
100
145
|
|
101
|
-
expect(page).to have_content("Editing #{<%= singular
|
146
|
+
expect(page).to have_content("Editing #{<%= singular %>1.<%= @display_class %> || "(no name)"}")
|
102
147
|
<%=
|
103
148
|
@columns.map { |col|
|
104
149
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
105
|
-
|
150
|
+
limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
151
|
+
sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
|
106
152
|
case type
|
107
153
|
when :datetime
|
108
154
|
when :integer
|
155
|
+
if !col.to_s.ends_with?("_id")
|
156
|
+
" new_#{col} = rand(10000).floor \n" +
|
157
|
+
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s})"
|
158
|
+
end
|
159
|
+
when :text
|
160
|
+
if sql_type == "text"
|
161
|
+
" " + "new_#{col.to_s} = FFaker::Lorem.paragraphs(3).join \n" +
|
162
|
+
' find("textarea[name=\'' + singular + '[' + col.to_s + ']\']").fill_in(with: new_' + col.to_s + ')'
|
163
|
+
|
164
|
+
else # unreachable?
|
165
|
+
" " + "new_#{col.to_s} = FFaker::Name.name \n" +
|
166
|
+
' find("input[name=\'' + singular + '[' + col.to_s + ']\']").fill_in(with: new_' + col.to_s + ')'
|
167
|
+
end
|
168
|
+
when :string
|
169
|
+
if sql_type == "varchar"
|
170
|
+
" " + "new_#{col.to_s} = FFaker::Name.name \n" +
|
171
|
+
' find("input[name=\'' + singular + '[' + col.to_s + ']\']").fill_in(with: new_' + col.to_s + ')'
|
172
|
+
else
|
173
|
+
" " + "new_#{col.to_s} = FFaker::Lorem.paragraphs(1).join \n" +
|
174
|
+
' find("input[name=\'' + singular + '[' + col.to_s + ']\']").fill_in(with: new_' + col.to_s + ')'
|
175
|
+
end
|
176
|
+
when :boolean
|
177
|
+
" new_#{col} = rand(2).floor \n" +
|
178
|
+
" find(\"[name='#{singular}[#{col}]'][value='\#{new_#{col}}']\").choose"
|
179
|
+
when :float
|
180
|
+
" new_#{col} = rand(1)*5000 \n" +
|
181
|
+
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s })"
|
182
|
+
when :date
|
183
|
+
" new_#{col} = Date.current + rand(100).days \n" +
|
184
|
+
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s })"
|
185
|
+
when :time
|
186
|
+
" new_#{col} = Time.current + rand(144).hours \n" +
|
187
|
+
" find(\"[name='#{singular}[#{col}]']\").fill_in(with: new_#{col.to_s })"
|
109
188
|
else
|
110
|
-
" " + "new_#{col.to_s} =
|
111
|
-
|
112
|
-
' find("input[name=\'' + singular + '[' + col.to_s + ']\'").fill_in(with: new_' + col.to_s + ')'
|
189
|
+
" " + "new_#{col.to_s} = FFaker::Name.name \n" +
|
190
|
+
' find("input[name=\'' + singular + '[' + col.to_s + ']\']").fill_in(with: new_' + col.to_s + ')'
|
113
191
|
|
114
192
|
end
|
115
193
|
}.join("\n")
|
@@ -123,11 +201,19 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
123
201
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
124
202
|
case type
|
125
203
|
when :datetime
|
126
|
-
|
204
|
+
# TODO: implement me
|
205
|
+
when :time
|
206
|
+
# TODO: implement me
|
207
|
+
when :date
|
208
|
+
# TODO: implement me
|
209
|
+
when :boolean
|
210
|
+
# TODO: implement me
|
127
211
|
else
|
212
|
+
unless type==:integer && col.to_s.ends_with?("_id")
|
128
213
|
' expect(page).to have_content(new_' + col.to_s + ')'
|
214
|
+
end
|
129
215
|
end
|
130
|
-
}.join("\n")
|
216
|
+
}.compact.join("\n")
|
131
217
|
%>
|
132
218
|
|
133
219
|
end
|
@@ -137,10 +223,12 @@ describe "interaction for <%= controller_class_name %>", type: :feature do
|
|
137
223
|
describe "destroy" do
|
138
224
|
it "should destroy" do
|
139
225
|
visit <%= path_helper_plural %>
|
140
|
-
accept_alert do
|
141
|
-
|
142
|
-
end
|
143
|
-
|
226
|
+
#accept_alert do
|
227
|
+
# find("form[action='<%= namespace_with_dash %>/<%= plural %>/#{<%= singular %>1.id}'] > button.delete-<%= singular %>-button").click
|
228
|
+
#end
|
229
|
+
find("form[action='<%= namespace_with_dash %>/<%= plural %>/#{<%= singular %>1.id}'] > button.delete-<%= singular %>-button").click
|
230
|
+
|
231
|
+
expect(page).to_not have_content(<%= singular %>1.<%= @display_class %>)
|
144
232
|
expect(<%= singular_class %>.where(id: <%= singular %>1.id).count).to eq(0)
|
145
233
|
end
|
146
234
|
end
|
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.2.
|
4
|
+
version: 0.2.5
|
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-10-
|
11
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|