hot-glue 0.5.9.1 → 0.5.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,55 +1,20 @@
1
- require 'rails_helper'
1
+ <% item1_addOns = ""
2
+ if (eval(@singular_class).instance_methods.include?(display_class.to_s))
3
+ item1_addOns << "#{display_class}: FFaker::Name.name"
4
+ end
5
+ item1_addOns << ", " + @columns_map.collect{|col, col_object|
6
+ col_object.spec_setup_let_arg
7
+ }.compact.join(", ")
8
+ %>require 'rails_helper'
2
9
 
3
10
  describe 'interaction for <%= controller_class_name %>' do
4
11
  include HotGlue::ControllerHelper
5
12
  include ActionView::RecordIdentifier
6
13
 
7
14
  <%= @existing_content %>
8
- <% unless @god %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<%end%>
15
+ <% unless @god %>let(:<%= @auth %>) {create(:<%= @auth.gsub('current_', '') %>)}<% end %>
9
16
  <%= spec_related_column_lets %>
10
- <% item1_addOns = ""
11
- if (eval(@singular_class).instance_methods.include?(display_class.to_s))
12
- item1_addOns << "#{display_class}: FFaker::Name.name"
13
- end
14
-
15
- item1_addOns << ", " + (@columns - @attachments.keys.collect(&:to_sym)).map { |col|
16
- type = eval("#{singular_class}.columns_hash['#{col}']").type
17
- case type
18
- when :string
19
- faker_string =
20
- if col.to_s.include?('email')
21
- "#{col}: FFaker::Internet.email"
22
- elsif col.to_s.include?('domain')
23
- "#{col}: FFaker::Internet.domain_name"
24
- elsif col.to_s.include?('ip_address') || col.to_s.ends_with?('_ip')
25
- "#{col}: FFaker::Internet.ip_v4_address"
26
- else
27
- "#{col}: FFaker::Movie.title"
28
- end
29
- when :text
30
- "#{col}: FFaker::Lorem.paragraphs(10).join(" ")"
31
-
32
- when :float
33
- "#{col}: rand(1)*10000"
34
- when :boolean
35
- "#{col}: !!rand(2).floor"
36
- when :time
37
- "#{col}: Time.current + rand(5000).seconds"
38
- when :date
39
- "#{col}: Date.current + rand(50).days"
40
- when :datetime
41
- "#{col}: DateTime.current + rand(1000).seconds"
42
- when :integer
43
- if col.to_s.ends_with?("_id")
44
- "#{col.to_s.gsub('_id','')}: #{col.to_s.gsub('_id','')}1"
45
- else
46
- "#{col}: rand(100)"
47
- end
48
- when :uuid
49
- "#{col.to_s.gsub('_id','')}: #{col.to_s.gsub('_id','')}1"
50
- end
51
- }.compact.join(", ")
52
- %>let!(:<%= singular %>1) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> <%= item1_addOns %> )}
17
+ let!(:<%= singular %>1) {create(:<%= singular %><%= object_parent_mapping_as_argument_for_specs %> <%= item1_addOns %> )}
53
18
  <%= objest_nest_factory_setup %> <% unless @god || @existing_content.include?("login_as")%>
54
19
  before do
55
20
  login_as(<%= @auth %>)
@@ -60,36 +25,7 @@ describe 'interaction for <%= controller_class_name %>' do
60
25
  describe "index" do
61
26
  it "should show me the list" do
62
27
  visit <%= path_helper_plural %>
63
- <%=
64
- (@columns - @attachments.keys.collect(&:to_sym)).map { |col|
65
- type = eval("#{singular_class}.columns_hash['#{col}']").type
66
-
67
- case type
68
- when :datetime
69
- " " + ["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 ")
70
- when :integer
71
- if !col.ends_with?("_id")
72
- " " + ["expect(page).to have_content(#{singular}#{1}.#{col})"].join("\n ")
73
- end
74
- when :uuid
75
- assoc_name = col.to_s.gsub('_id','')
76
- association = eval("#{singular_class}.reflect_on_association(:#{assoc_name})")
77
- " " + ["expect(page).to have_content(#{singular}#{1}.#{assoc_name}.#{HotGlue.derrive_reference_name(association.class_name)})"].join("\n ")
78
- when :enum
79
- if(eval("#{singular_class}.respond_to?(:#{col}_labels)"))
80
- " " + "expect(page).to have_content(#{singular_class}.#{col}_labels[#{singular}#{1}.#{col}])"
81
- else
82
- " " + "expect(page).to have_content(#{singular}1.#{col})"
83
- end
84
-
85
- when :boolean
86
- " " + ["expect(page).to have_content(#{singular}#{1}.#{col} ? 'YES' : 'NO')"].join("\n ")
87
- else
88
- " " + ["expect(page).to have_content(#{singular}#{1}.#{col})"].join("\n ")
89
- end
90
-
91
- }.join("\n")
92
- %>
28
+ <%= @columns_map.collect{|col, col_object| col_object.spec_list_view_assertion } %>
93
29
  end
94
30
  end
95
31
 
@@ -98,40 +34,17 @@ describe 'interaction for <%= controller_class_name %>' do
98
34
  visit <%= path_helper_plural %>
99
35
  click_link "<%= @new_button_label %>"
100
36
  expect(page).to have_selector(:xpath, './/h3[contains(., "<%= @new_button_label %>")]')
101
- <%= test_capybara_block(:create) %>
37
+ <%= capybara_make_updates(:create) %>
102
38
  click_button "Save"
103
39
  expect(page).to have_content("Successfully created")
104
- <%=" " +
105
-
106
- ((@columns - @attachments.keys.collect(&:to_sym)) - @show_only).map { |col|
107
- type = eval("#{singular_class}.columns_hash['#{col}']").type
108
-
109
- case type
110
- when :datetime
111
- # " expect(page).to have_content(#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y') + \" @ \" +
112
- # new_#{col}.in_time_zone(current_timezone).strftime('%l').strip + \":\" +
113
- # new_#{col}.in_time_zone(current_timezone).strftime('%M %p').strip + \" \" +
114
- # timezonize(current_timezone))"
115
- when :integer
116
- if col.to_s.ends_with?("_id")
117
- # shoould the assoication be on here
118
- else
119
- "expect(page).to have_content(new_#{col})"
120
- end
121
40
 
122
- when :boolean
123
- ["expect(page).to have_content(#{singular}#{1}.#{col} ? 'YES' : 'NO')"].join("\n ")
124
- when :enum
125
- if(eval("#{singular_class}.respond_to?(:#{col}_labels)"))
126
- "expect(page).to have_content(#{singular_class}.#{col}_labels[new_#{col}])"
127
- else
128
- "expect(page).to have_content(new_#{col})"
129
- end
130
- else
131
- "expect(page).to have_content(new_#{col})"
132
- end
133
-
134
- }.compact.join("\n ")
41
+ <%=" " + @columns_map.map{ |col, col_object|
42
+ if @attachments.keys.collect(&:to_sym).include?(col)
43
+ elsif @show_only.include?(col)
44
+ else
45
+ col_object.spec_make_assertion
46
+ end
47
+ }.compact.join("\n ")
135
48
  %>
136
49
  end
137
50
  end<% end %>
@@ -143,10 +56,10 @@ describe 'interaction for <%= controller_class_name %>' do
143
56
  find("a.edit-<%= singular %>-button[href='/<%= namespace_with_slash %><%= plural %>/#{<%= singular %>1.id}/edit']").click
144
57
 
145
58
  expect(page).to have_content("Editing #{<%= singular %>1.<%= @display_class %>.squish || "(no name)"}")
146
- <%= test_capybara_block(:update) %>
59
+ <%= capybara_make_updates(:update) %>
147
60
  click_button "Save"
148
61
  within("turbo-frame#<%= @namespace %>__#{dom_id(<%= singular %>1)} ") do
149
- <%= ((@columns - @attachments.keys.collect(&:to_sym)) - @show_only).map { |col|
62
+ <%= ((@columns - @attachments.keys.collect(&:to_sym)) - (@show_only+@update_show_only)).map { |col|
150
63
  type = eval("#{singular_class}.columns_hash['#{col}']").type
151
64
 
152
65
  if type == :uuid || (type == :integer && col.to_s.ends_with?("_id"))
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.5.9.1'
3
+ CURRENT = '0.5.9.2'
4
4
  end
5
5
  end
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.5.9.1
4
+ version: 0.5.9.2
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: 2023-03-19 00:00:00.000000000 Z
11
+ date: 2023-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -77,6 +77,20 @@ files:
77
77
  - db/schema.rb
78
78
  - lib/generators/hot_glue/direct_upload_install_generator.rb
79
79
  - lib/generators/hot_glue/dropzone_install_generator.rb
80
+ - lib/generators/hot_glue/field_factory.rb
81
+ - lib/generators/hot_glue/fields/association_field.rb
82
+ - lib/generators/hot_glue/fields/attachment_field.rb
83
+ - lib/generators/hot_glue/fields/boolean_field.rb
84
+ - lib/generators/hot_glue/fields/date_field.rb
85
+ - lib/generators/hot_glue/fields/date_time_field.rb
86
+ - lib/generators/hot_glue/fields/enum_field.rb
87
+ - lib/generators/hot_glue/fields/field.rb
88
+ - lib/generators/hot_glue/fields/float_field.rb
89
+ - lib/generators/hot_glue/fields/integer_field.rb
90
+ - lib/generators/hot_glue/fields/string_field.rb
91
+ - lib/generators/hot_glue/fields/text_field.rb
92
+ - lib/generators/hot_glue/fields/time_field.rb
93
+ - lib/generators/hot_glue/fields/uuid_field.rb
80
94
  - lib/generators/hot_glue/install_generator.rb
81
95
  - lib/generators/hot_glue/layout/builder.rb
82
96
  - lib/generators/hot_glue/layout_strategy/base.rb
@@ -88,6 +102,7 @@ files:
88
102
  - lib/generators/hot_glue/scaffold_generator.rb
89
103
  - lib/generators/hot_glue/templates/base_controller.rb.erb
90
104
  - lib/generators/hot_glue/templates/capybara_login.rb
105
+ - lib/generators/hot_glue/templates/computer_code.jpg
91
106
  - lib/generators/hot_glue/templates/controller.rb.erb
92
107
  - lib/generators/hot_glue/templates/erb/_errors.erb
93
108
  - lib/generators/hot_glue/templates/erb/_flash_notices.erb