dry_crud 6.0.0 → 7.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/MIT-LICENSE +2 -2
- data/README.rdoc +7 -6
- data/VERSION +1 -1
- data/app/assets/stylesheets/sample.scss +45 -24
- data/app/controllers/crud_controller.rb +19 -19
- data/app/controllers/dry_crud/generic_model.rb +2 -4
- data/app/controllers/dry_crud/render_callbacks.rb +3 -3
- data/app/controllers/list_controller.rb +1 -1
- data/app/helpers/actions_helper.rb +7 -7
- data/app/helpers/dry_crud/form/builder.rb +40 -43
- data/app/helpers/dry_crud/form/control.rb +8 -11
- data/app/helpers/dry_crud/table/actions.rb +12 -12
- data/app/helpers/dry_crud/table/builder.rb +10 -10
- data/app/helpers/dry_crud/table/col.rb +4 -4
- data/app/helpers/form_helper.rb +6 -8
- data/app/helpers/format_helper.rb +7 -7
- data/app/helpers/i18n_helper.rb +5 -5
- data/app/helpers/table_helper.rb +15 -16
- data/app/helpers/utility_helper.rb +3 -3
- data/app/views/crud/new.html.erb +1 -1
- data/app/views/crud/new.html.haml +1 -1
- data/app/views/layouts/application.html.erb +8 -6
- data/app/views/layouts/application.html.haml +6 -5
- data/app/views/list/_search.html.erb +1 -3
- data/app/views/list/_search.html.haml +1 -2
- data/app/views/shared/_error_messages.html.erb +2 -2
- data/lib/generators/dry_crud/dry_crud_generator.rb +1 -1
- data/lib/generators/dry_crud/templates/spec/controllers/crud_test_models_controller_spec.rb +4 -4
- data/lib/generators/dry_crud/templates/spec/helpers/dry_crud/form/builder_spec.rb +3 -3
- data/lib/generators/dry_crud/templates/spec/helpers/dry_crud/table/builder_spec.rb +1 -1
- data/lib/generators/dry_crud/templates/spec/helpers/form_helper_spec.rb +6 -5
- data/lib/generators/dry_crud/templates/spec/helpers/format_helper_spec.rb +2 -2
- data/lib/generators/dry_crud/templates/spec/helpers/table_helper_spec.rb +6 -6
- data/lib/generators/dry_crud/templates/spec/helpers/utility_helper_spec.rb +2 -2
- data/lib/generators/dry_crud/templates/spec/support/crud_controller_examples.rb +4 -6
- data/lib/generators/dry_crud/templates/spec/support/crud_controller_test_helper.rb +3 -3
- data/lib/generators/dry_crud/templates/test/controllers/crud_test_models_controller_test.rb +1 -1
- data/lib/generators/dry_crud/templates/test/helpers/custom_assertions_test.rb +5 -5
- data/lib/generators/dry_crud/templates/test/helpers/dry_crud/form/builder_test.rb +3 -3
- data/lib/generators/dry_crud/templates/test/helpers/form_helper_test.rb +8 -8
- data/lib/generators/dry_crud/templates/test/helpers/table_helper_test.rb +7 -7
- data/lib/generators/dry_crud/templates/test/helpers/utility_helper_test.rb +2 -2
- data/lib/generators/dry_crud/templates/test/support/crud_test_helper.rb +6 -6
- data/lib/generators/dry_crud/templates/test/support/crud_test_model.rb +2 -3
- data/lib/generators/dry_crud/templates/test/support/crud_test_models_controller.rb +4 -6
- data/lib/generators/dry_crud/templates/test/support/custom_assertions.rb +6 -6
- metadata +9 -10
@@ -15,11 +15,11 @@ describe FormatHelper do
|
|
15
15
|
after(:all) { reset_db }
|
16
16
|
|
17
17
|
# define some test format_ methods
|
18
|
-
def format_size(obj)
|
18
|
+
def format_size(obj) # :nodoc:
|
19
19
|
"#{f(obj.size)} items"
|
20
20
|
end
|
21
21
|
|
22
|
-
def format_string_size(obj)
|
22
|
+
def format_string_size(obj) # :nodoc:
|
23
23
|
"#{f(obj.size)} chars"
|
24
24
|
end
|
25
25
|
|
@@ -34,7 +34,7 @@ describe TableHelper do
|
|
34
34
|
it { is_expected.to be_html_safe }
|
35
35
|
|
36
36
|
it 'handles empty data' do
|
37
|
-
is_expected.to match(/div class=.table
|
37
|
+
is_expected.to match(/div class=.table.>.+<\/div>/)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -46,7 +46,7 @@ describe TableHelper do
|
|
46
46
|
it { is_expected.to be_html_safe }
|
47
47
|
|
48
48
|
it 'renders table' do
|
49
|
-
is_expected.to match(
|
49
|
+
is_expected.to match(/^<table.*<\/table>$/)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -87,7 +87,7 @@ describe TableHelper do
|
|
87
87
|
with_test_routing do
|
88
88
|
list_table do |t|
|
89
89
|
t.attrs :name, :children, :companion_id
|
90
|
-
t.col('head') { |e|
|
90
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -113,7 +113,7 @@ describe TableHelper do
|
|
113
113
|
subject do
|
114
114
|
with_test_routing do
|
115
115
|
list_table(:name, :children, :companion_id) do |t|
|
116
|
-
t.col('head') { |e|
|
116
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
@@ -223,7 +223,7 @@ describe TableHelper do
|
|
223
223
|
with_test_routing do
|
224
224
|
crud_table do |t|
|
225
225
|
t.attrs :name, :children, :companion_id
|
226
|
-
t.col('head') { |e|
|
226
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
@@ -245,7 +245,7 @@ describe TableHelper do
|
|
245
245
|
subject do
|
246
246
|
with_test_routing do
|
247
247
|
crud_table(:name, :children, :companion_id) do |t|
|
248
|
-
t.col('head') { |e|
|
248
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
@@ -33,7 +33,7 @@ describe UtilityHelper do
|
|
33
33
|
describe '#content_tag_nested' do
|
34
34
|
|
35
35
|
it 'escapes safe content' do
|
36
|
-
html = content_tag_nested(:div, %w[a b]) { |e|
|
36
|
+
html = content_tag_nested(:div, %w[a b]) { |e| tag.span(e) }
|
37
37
|
expect(html).to be_html_safe
|
38
38
|
expect(html).to eq('<div><span>a</span><span>b</span></div>')
|
39
39
|
end
|
@@ -56,7 +56,7 @@ describe UtilityHelper do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'collects contents for array' do
|
59
|
-
html = safe_join(%w[a b]) { |e|
|
59
|
+
html = safe_join(%w[a b]) { |e| tag.span(e) }
|
60
60
|
expect(html).to eq('<span>a</span><span>b</span>')
|
61
61
|
end
|
62
62
|
end
|
@@ -36,9 +36,7 @@ shared_examples 'crud controller' do |options|
|
|
36
36
|
|
37
37
|
before do
|
38
38
|
m = RSpec.current_example.metadata
|
39
|
-
if m[:perform_request] != false && m[:action] && m[:method]
|
40
|
-
perform_combined_request
|
41
|
-
end
|
39
|
+
perform_combined_request if m[:perform_request] != false && m[:action] && m[:method]
|
42
40
|
end
|
43
41
|
|
44
42
|
describe_action :get, :index,
|
@@ -144,7 +142,7 @@ shared_examples 'crud controller' do |options|
|
|
144
142
|
unless: skip?(options, %w[new plain]),
|
145
143
|
combine: 'new' do
|
146
144
|
it_is_expected_to_respond
|
147
|
-
it_is_expected_to_persist_entry(false)
|
145
|
+
it_is_expected_to_persist_entry(persist: false)
|
148
146
|
end
|
149
147
|
|
150
148
|
context 'with params',
|
@@ -179,7 +177,7 @@ shared_examples 'crud controller' do |options|
|
|
179
177
|
failing: true,
|
180
178
|
unless: skip?(options, %w[create html invalid]),
|
181
179
|
combine: 'chi' do
|
182
|
-
it_is_expected_to_persist_entry(false)
|
180
|
+
it_is_expected_to_persist_entry(persist: false)
|
183
181
|
it_is_expected_to_set_attrs(:new)
|
184
182
|
it_is_expected_to_not_have_flash(:notice)
|
185
183
|
end
|
@@ -205,7 +203,7 @@ shared_examples 'crud controller' do |options|
|
|
205
203
|
it_is_expected_to_respond(422)
|
206
204
|
it_is_expected_to_set_attrs(:new)
|
207
205
|
it_is_expected_to_render_json
|
208
|
-
it_is_expected_to_persist_entry(false)
|
206
|
+
it_is_expected_to_persist_entry(persist: false)
|
209
207
|
end
|
210
208
|
end
|
211
209
|
end
|
@@ -117,7 +117,7 @@ module CrudControllerTestHelper
|
|
117
117
|
it 'sets params as entry attributes' do
|
118
118
|
attrs = send("#{action}_entry_attrs")
|
119
119
|
actual = {}
|
120
|
-
attrs.
|
120
|
+
attrs.each_key do |key|
|
121
121
|
actual[key] = entry.attributes[key.to_s]
|
122
122
|
end
|
123
123
|
expect(actual).to eq(attrs)
|
@@ -156,11 +156,11 @@ module CrudControllerTestHelper
|
|
156
156
|
end
|
157
157
|
|
158
158
|
# Test that the current entry is persistend and valid, or not.
|
159
|
-
def it_is_expected_to_persist_entry(
|
159
|
+
def it_is_expected_to_persist_entry(persist: true)
|
160
160
|
context 'entry' do
|
161
161
|
subject { entry }
|
162
162
|
|
163
|
-
if
|
163
|
+
if persist
|
164
164
|
it { is_expected.not_to be_new_record }
|
165
165
|
it { is_expected.to be_valid }
|
166
166
|
else
|
@@ -295,7 +295,7 @@ class CrudTestModelsControllerTest < ActionController::TestCase
|
|
295
295
|
|
296
296
|
def test_models_label
|
297
297
|
assert_equal 'Crud Test Models', @controller.models_label
|
298
|
-
assert_equal 'Crud Test Model', @controller.models_label(false)
|
298
|
+
assert_equal 'Crud Test Model', @controller.models_label(plural: false)
|
299
299
|
end
|
300
300
|
|
301
301
|
private
|
@@ -25,7 +25,7 @@ class CustomAssertionsTest < ActiveSupport::TestCase
|
|
25
25
|
end
|
26
26
|
|
27
27
|
test 'assert count fails if count does not match' do
|
28
|
-
assert_raise(
|
28
|
+
assert_raise(Minitest::Assertion) do
|
29
29
|
assert_count 2, 'ba', 'barbabapa'
|
30
30
|
end
|
31
31
|
end
|
@@ -37,7 +37,7 @@ class CustomAssertionsTest < ActiveSupport::TestCase
|
|
37
37
|
end
|
38
38
|
|
39
39
|
test 'assert valid record fails for invalid' do
|
40
|
-
assert_raise(
|
40
|
+
assert_raise(Minitest::Assertion) do
|
41
41
|
assert_valid invalid_record
|
42
42
|
end
|
43
43
|
end
|
@@ -55,19 +55,19 @@ class CustomAssertionsTest < ActiveSupport::TestCase
|
|
55
55
|
end
|
56
56
|
|
57
57
|
test 'assert not valid fails if record valid' do
|
58
|
-
assert_raise(
|
58
|
+
assert_raise(Minitest::Assertion) do
|
59
59
|
assert_not_valid crud_test_models('AAAAA')
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
test 'assert not valid fails if record invalid and valid attrs given' do
|
64
|
-
assert_raise(
|
64
|
+
assert_raise(Minitest::Assertion) do
|
65
65
|
assert_not_valid invalid_record, :name, :rating, :children
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
test 'assert not valid fails if not all invalid attrs given' do
|
70
|
-
assert_raise(
|
70
|
+
assert_raise(Minitest::Assertion) do
|
71
71
|
assert_not_valid invalid_record, :name
|
72
72
|
end
|
73
73
|
end
|
@@ -97,15 +97,15 @@ module DryCrud
|
|
97
97
|
|
98
98
|
test 'labeld_input_field adds required mark' do
|
99
99
|
result = form.labeled_input_field(:name)
|
100
|
-
assert result.include?('input-group-
|
100
|
+
assert result.include?('input-group-text')
|
101
101
|
result = form.labeled_input_field(:remarks)
|
102
|
-
assert_not result.include?('input-group-
|
102
|
+
assert_not result.include?('input-group-text')
|
103
103
|
end
|
104
104
|
|
105
105
|
test 'labeld_input_field adds help text' do
|
106
106
|
result = form.labeled_input_field(:name, help: 'Some Help')
|
107
107
|
assert result.include?(form.help_block('Some Help'))
|
108
|
-
assert result.include?('input-group-
|
108
|
+
assert result.include?('input-group-text')
|
109
109
|
end
|
110
110
|
|
111
111
|
test 'belongs_to_field has all options by default' do
|
@@ -57,16 +57,16 @@ class FormHelperTest < ActionView::TestCase
|
|
57
57
|
assert_match(/input .*?type="date"
|
58
58
|
.*?name="crud_test_model\[birthdate\]"/x, f)
|
59
59
|
assert_match(/input .*?type="number"
|
60
|
-
.*?value
|
60
|
+
.*?value="9"
|
61
61
|
.*?name="crud_test_model\[children\]"/x, f)
|
62
62
|
assert_match(/input .*?type="checkbox"
|
63
63
|
.*?name="crud_test_model\[human\]"/x, f)
|
64
|
-
assert_match(/button\ .*?type="submit"
|
64
|
+
assert_match(/button\ .*?type="submit".*>
|
65
65
|
#{t('global.button.save')}
|
66
|
-
|
67
|
-
assert_match(
|
66
|
+
<\/button>/x, f)
|
67
|
+
assert_match(/<a\ .*href="\/somewhere".*>
|
68
68
|
#{t('global.button.cancel')}
|
69
|
-
|
69
|
+
<\/a>/x, f)
|
70
70
|
end
|
71
71
|
|
72
72
|
test 'standard form with errors' do
|
@@ -88,9 +88,9 @@ class FormHelperTest < ActionView::TestCase
|
|
88
88
|
.*?name="_method"
|
89
89
|
.*?value="(patch|put)"/x, f)
|
90
90
|
assert_match(/div[^>]* id='error_explanation'/, f)
|
91
|
-
assert_match(/
|
92
|
-
|
93
|
-
|
91
|
+
assert_match(/input .*?class="is-invalid\ form-control"
|
92
|
+
.*?type="text"
|
93
|
+
.*?name="crud_test_model\[name\]"/x, f)
|
94
94
|
assert_match(/input .*?value="1910-01-01"
|
95
95
|
.*?type="date"
|
96
96
|
.*?name="crud_test_model\[birthdate\]"/x, f)
|
@@ -31,9 +31,9 @@ class TableHelperTest < ActionView::TestCase
|
|
31
31
|
end
|
32
32
|
|
33
33
|
test 'empty table renders message' do
|
34
|
-
result = plain_table_or_message([])
|
34
|
+
result = plain_table_or_message([])
|
35
35
|
assert result.html_safe?
|
36
|
-
assert_match(
|
36
|
+
assert_match(/<div class=["']table["']>.*<\/div>/, result)
|
37
37
|
end
|
38
38
|
|
39
39
|
test 'non empty table renders table' do
|
@@ -41,7 +41,7 @@ class TableHelperTest < ActionView::TestCase
|
|
41
41
|
t.attrs :size, :upcase
|
42
42
|
end
|
43
43
|
assert result.html_safe?
|
44
|
-
assert_match(
|
44
|
+
assert_match(/^<table.*<\/table>$/, result)
|
45
45
|
end
|
46
46
|
|
47
47
|
test 'table with attrs' do
|
@@ -84,7 +84,7 @@ class TableHelperTest < ActionView::TestCase
|
|
84
84
|
table = with_test_routing do
|
85
85
|
list_table do |t|
|
86
86
|
t.attrs :name, :children, :companion_id
|
87
|
-
t.col('head') { |e|
|
87
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -99,7 +99,7 @@ class TableHelperTest < ActionView::TestCase
|
|
99
99
|
|
100
100
|
table = with_test_routing do
|
101
101
|
list_table :name, :children, :companion_id do |t|
|
102
|
-
t.col('head') { |e|
|
102
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -181,7 +181,7 @@ class TableHelperTest < ActionView::TestCase
|
|
181
181
|
table = with_test_routing do
|
182
182
|
crud_table do |t|
|
183
183
|
t.attrs :name, :children, :companion_id
|
184
|
-
t.col('head') { |e|
|
184
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -196,7 +196,7 @@ class TableHelperTest < ActionView::TestCase
|
|
196
196
|
|
197
197
|
table = with_test_routing do
|
198
198
|
crud_table :name, :children, :companion_id do |t|
|
199
|
-
t.col('head') { |e|
|
199
|
+
t.col('head') { |e| tag.span(e.income.to_s) }
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
@@ -10,7 +10,7 @@ class UtilityHelperTest < ActionView::TestCase
|
|
10
10
|
teardown :reset_db
|
11
11
|
|
12
12
|
test 'content_tag_nested escapes safe correctly' do
|
13
|
-
html = content_tag_nested(:div, %w[a b]) { |e|
|
13
|
+
html = content_tag_nested(:div, %w[a b]) { |e| tag.span(e) }
|
14
14
|
assert_equal '<div><span>a</span><span>b</span></div>', html
|
15
15
|
end
|
16
16
|
|
@@ -30,7 +30,7 @@ class UtilityHelperTest < ActionView::TestCase
|
|
30
30
|
end
|
31
31
|
|
32
32
|
test 'safe_join with block' do
|
33
|
-
html = safe_join(%w[a b]) { |e|
|
33
|
+
html = safe_join(%w[a b]) { |e| tag.span(e) }
|
34
34
|
assert_equal '<span>a</span><span>b</span>', html
|
35
35
|
end
|
36
36
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# :nodoc:
|
2
2
|
REGEXP_ROWS = /<tr.+?<\/tr>/m.freeze
|
3
3
|
REGEXP_HEADERS = /<th.+?<\/th>/m.freeze
|
4
4
|
REGEXP_SORT_HEADERS = /<th.*?><a .*?sort_dir=asc.*?>.*?<\/a><\/th>/m.freeze
|
5
|
-
REGEXP_ACTION_CELL = /<td class
|
5
|
+
REGEXP_ACTION_CELL = /<td class="action"><a .*?href.+?<\/a><\/td>/m.freeze
|
6
6
|
|
7
7
|
# A simple test helper to prepare the test database with a CrudTestModel model.
|
8
8
|
# This helper is used to test the CrudController and various helpers
|
@@ -150,15 +150,15 @@ module CrudTestHelper
|
|
150
150
|
name: c,
|
151
151
|
children: 10 - index,
|
152
152
|
rating: "#{index}.#{index}".to_f,
|
153
|
-
income: 10_000_000 * index + 0.1111 * index,
|
154
|
-
birthdate: "#{1900 + 10 * index}-#{index}-#{index}",
|
153
|
+
income: (10_000_000 * index) + (0.1111 * index),
|
154
|
+
birthdate: "#{1900 + (10 * index)}-#{index}-#{index}",
|
155
155
|
# store entire date to avoid time zone issues
|
156
156
|
gets_up_at: Time.zone.local(2000, 1, 1, index, index),
|
157
|
-
last_seen: "#{2000 + 10 * index}-#{index}-#{index} " \
|
157
|
+
last_seen: "#{2000 + (10 * index)}-#{index}-#{index} " \
|
158
158
|
"1#{index}:2#{index}",
|
159
159
|
human: index.even?,
|
160
160
|
remarks: "#{c} #{str(index + 1)} #{str(index + 2)}\n" *
|
161
|
-
(index % 3 + 1)
|
161
|
+
((index % 3) + 1)
|
162
162
|
)
|
163
163
|
m.companion = companion
|
164
164
|
m.save!
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# A dummy model used for general testing.
|
2
|
-
class CrudTestModel < ApplicationRecord
|
2
|
+
class CrudTestModel < ApplicationRecord # :nodoc:
|
3
3
|
|
4
4
|
belongs_to :companion, class_name: 'CrudTestModel', optional: true
|
5
5
|
has_and_belongs_to_many :others, class_name: 'OtherCrudTestModel'
|
@@ -33,11 +33,10 @@ class CrudTestModel < ApplicationRecord #:nodoc:
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# Second dummy model to test associations.
|
36
|
-
class OtherCrudTestModel < ApplicationRecord
|
36
|
+
class OtherCrudTestModel < ApplicationRecord # :nodoc:
|
37
37
|
|
38
38
|
has_and_belongs_to_many :others, class_name: 'CrudTestModel'
|
39
39
|
belongs_to :more,
|
40
|
-
foreign_key: :more_id,
|
41
40
|
class_name: 'CrudTestModel',
|
42
41
|
optional: true
|
43
42
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Controller for the dummy model.
|
2
|
-
class CrudTestModelsController < CrudController
|
2
|
+
class CrudTestModelsController < CrudController # :nodoc:
|
3
3
|
|
4
4
|
HANDLE_PREFIX = 'handle_'.freeze
|
5
5
|
|
@@ -9,7 +9,7 @@ class CrudTestModelsController < CrudController #:nodoc:
|
|
9
9
|
self.permitted_attrs = [:name, :email, :password, :whatever, :children,
|
10
10
|
:companion_id, :rating, :income, :birthdate,
|
11
11
|
:gets_up_at, :last_seen, :human, :remarks,
|
12
|
-
other_ids: []]
|
12
|
+
{ other_ids: [] }]
|
13
13
|
|
14
14
|
before_create :possibly_redirect
|
15
15
|
before_create :handle_name
|
@@ -54,9 +54,7 @@ class CrudTestModelsController < CrudController #:nodoc:
|
|
54
54
|
|
55
55
|
def build_entry
|
56
56
|
entry = super
|
57
|
-
if params[model_identifier]
|
58
|
-
entry.companion_id = model_params.delete(:companion_id)
|
59
|
-
end
|
57
|
+
entry.companion_id = model_params.delete(:companion_id) if params[model_identifier]
|
60
58
|
entry
|
61
59
|
end
|
62
60
|
|
@@ -94,7 +92,7 @@ class CrudTestModelsController < CrudController #:nodoc:
|
|
94
92
|
# handle the called callbacks
|
95
93
|
def method_missing(sym, *_args)
|
96
94
|
if sym.to_s.starts_with?(HANDLE_PREFIX)
|
97
|
-
called_callback(sym.to_s[HANDLE_PREFIX.size
|
95
|
+
called_callback(sym.to_s[HANDLE_PREFIX.size..].to_sym)
|
98
96
|
else
|
99
97
|
super
|
100
98
|
end
|
@@ -14,7 +14,7 @@ module CustomAssertions
|
|
14
14
|
actual = string.scan(regexp).size
|
15
15
|
msg = message(msg) do
|
16
16
|
"Expected #{mu_pp(regexp)} to occur #{expected} time(s), " \
|
17
|
-
|
17
|
+
"but occured #{actual} time(s) in \n#{mu_pp(string)}"
|
18
18
|
end
|
19
19
|
assert expected == actual, msg
|
20
20
|
end
|
@@ -50,7 +50,7 @@ module CustomAssertions
|
|
50
50
|
# The method used to by Test::Unit to format arguments.
|
51
51
|
# Prints ActiveRecord objects in a simpler format.
|
52
52
|
def mu_pp(obj)
|
53
|
-
if obj.is_a?(ActiveRecord::Base)
|
53
|
+
if obj.is_a?(ActiveRecord::Base) # :nodoc:
|
54
54
|
obj.to_s
|
55
55
|
else
|
56
56
|
super
|
@@ -69,12 +69,12 @@ module CustomAssertions
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def assert_other_attrs_have_no_errors(record, *invalid_attrs)
|
72
|
-
record.errors.each do |
|
72
|
+
record.errors.each do |error|
|
73
73
|
msg = message do
|
74
|
-
"Attribute #{mu_pp(
|
75
|
-
|
74
|
+
"Attribute #{mu_pp(error.attribute)} not declared as invalid attribute, " \
|
75
|
+
"but has the following error(s):\n#{mu_pp(error.message)}"
|
76
76
|
end
|
77
|
-
assert invalid_attrs.include?(
|
77
|
+
assert invalid_attrs.include?(error.attribute), msg
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry_crud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pascal Zumkehr
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,19 +16,19 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '7.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '7.1'
|
27
27
|
description: |
|
28
28
|
Generates simple and extendable controller, views and helpers that support you
|
29
29
|
to DRY up the CRUD code in your Rails project. Start with these elements and
|
30
30
|
build a clean base to efficiently develop your application upon.
|
31
|
-
email:
|
31
|
+
email: pascal+github@codez.ch
|
32
32
|
executables: []
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files:
|
@@ -142,7 +142,7 @@ files:
|
|
142
142
|
homepage: http://github.com/codez/dry_crud
|
143
143
|
licenses: []
|
144
144
|
metadata: {}
|
145
|
-
post_install_message:
|
145
|
+
post_install_message:
|
146
146
|
rdoc_options:
|
147
147
|
- "--title"
|
148
148
|
- '"Dry Crud"'
|
@@ -162,9 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
|
-
|
166
|
-
|
167
|
-
signing_key:
|
165
|
+
rubygems_version: 3.3.26
|
166
|
+
signing_key:
|
168
167
|
specification_version: 4
|
169
168
|
summary: Generates DRY and specifically extendable CRUD controller, views and helpers
|
170
169
|
for Rails applications.
|