comma 4.3.1 → 4.6.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/workflows/build.yml +47 -0
- data/.rubocop.yml +3 -0
- data/.travis.yml +25 -32
- data/Appraisals +31 -6
- data/Gemfile +3 -1
- data/Gemfile.lock +39 -23
- data/README.md +3 -3
- data/comma.gemspec +3 -5
- data/gemfiles/active5.2.5.gemfile +12 -0
- data/gemfiles/{active5.2.3.gemfile.lock → active5.2.5.gemfile.lock} +40 -34
- data/gemfiles/active6.0.3.6.gemfile +12 -0
- data/gemfiles/{active5.1.7.gemfile.lock → active6.0.3.6.gemfile.lock} +42 -36
- data/gemfiles/active6.1.3.1.gemfile +12 -0
- data/gemfiles/{active4.2.11.1.gemfile.lock → active6.1.3.1.gemfile.lock} +47 -44
- data/gemfiles/active7.0.0.gemfile +12 -0
- data/gemfiles/{active5.0.7.2.gemfile.lock → active7.0.0.gemfile.lock} +44 -41
- data/gemfiles/{rails5.2.3.gemfile → rails5.2.5.gemfile} +5 -2
- data/gemfiles/{rails5.2.3.gemfile.lock → rails5.2.5.gemfile.lock} +93 -86
- data/gemfiles/{rails4.2.11.1.gemfile → rails6.0.3.6.gemfile} +4 -2
- data/gemfiles/rails6.0.3.6.gemfile.lock +228 -0
- data/gemfiles/{rails5.0.7.2.gemfile → rails6.1.3.1.gemfile} +4 -2
- data/gemfiles/rails6.1.3.1.gemfile.lock +231 -0
- data/gemfiles/{rails5.1.7.gemfile → rails7.0.0.gemfile} +4 -3
- data/gemfiles/rails7.0.0.gemfile.lock +220 -0
- data/lib/comma/generator.rb +2 -2
- data/lib/comma/header_extractor.rb +2 -1
- data/lib/comma/version.rb +1 -1
- data/lib/comma.rb +2 -1
- data/spec/comma/comma_spec.rb +3 -3
- data/spec/comma/data_extractor_spec.rb +8 -8
- data/spec/comma/header_extractor_spec.rb +5 -5
- data/spec/comma/rails/active_record_spec.rb +13 -14
- data/spec/controllers/users_controller_spec.rb +45 -33
- data/spec/rails_app/active_record/models.rb +1 -8
- data/spec/spec_helper.rb +14 -1
- metadata +36 -45
- data/gemfiles/active4.2.11.1.gemfile +0 -10
- data/gemfiles/active5.0.7.2.gemfile +0 -10
- data/gemfiles/active5.1.7.gemfile +0 -10
- data/gemfiles/active5.2.3.gemfile +0 -10
- data/gemfiles/active6.0.0.gemfile +0 -10
- data/gemfiles/active6.0.0.gemfile.lock +0 -108
- data/gemfiles/rails4.2.11.1.gemfile.lock +0 -191
- data/gemfiles/rails5.0.7.2.gemfile.lock +0 -198
- data/gemfiles/rails5.1.7.gemfile.lock +0 -198
- data/gemfiles/rails6.0.0.gemfile +0 -11
- data/gemfiles/rails6.0.0.gemfile.lock +0 -237
data/lib/comma/version.rb
CHANGED
data/lib/comma.rb
CHANGED
|
@@ -31,12 +31,12 @@ ActiveSupport.on_load(:action_controller) do
|
|
|
31
31
|
ActionController::Renderers.add :csv do |obj, options|
|
|
32
32
|
filename = options[:filename] || 'data'
|
|
33
33
|
extension = options[:extension] || 'csv'
|
|
34
|
-
|
|
35
34
|
mime_type = if Rails.version >= '5.0.0'
|
|
36
35
|
options[:mime_type] || Mime[:csv]
|
|
37
36
|
else
|
|
38
37
|
options[:mime_type] || Mime::CSV
|
|
39
38
|
end
|
|
39
|
+
with_bom = options.delete(:with_bom) || false
|
|
40
40
|
|
|
41
41
|
# Capture any CSV optional settings passed to comma or comma specific options
|
|
42
42
|
csv_options = options.slice(*CSV_HANDLER::DEFAULT_OPTIONS.merge(Comma::DEFAULT_OPTIONS).keys)
|
|
@@ -50,6 +50,7 @@ ActiveSupport.on_load(:action_controller) do
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
data = obj.to_comma(csv_options)
|
|
53
|
+
data = "\xEF\xBB\xBF#{data}" if with_bom
|
|
53
54
|
disposition = "attachment; filename=\"#{filename}.#{extension}\""
|
|
54
55
|
send_data data, type: mime_type, disposition: disposition
|
|
55
56
|
end
|
data/spec/comma/comma_spec.rb
CHANGED
|
@@ -171,9 +171,9 @@ describe Comma, 'to_comma data/headers object extensions' do # rubocop:disable M
|
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
it 'should raise an error if the requested description is not avaliable' do
|
|
174
|
-
expect { @foo.to_comma(:bad) }.to raise_error
|
|
175
|
-
expect { @foo.to_comma_headers(:bad) }.to raise_error
|
|
176
|
-
expect { Array(@foo).to_comma(:bad) }.to raise_error
|
|
174
|
+
expect { @foo.to_comma(:bad) }.to raise_error(RuntimeError)
|
|
175
|
+
expect { @foo.to_comma_headers(:bad) }.to raise_error(RuntimeError)
|
|
176
|
+
expect { Array(@foo).to_comma(:bad) }.to raise_error(RuntimeError)
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
|
|
@@ -19,25 +19,25 @@ describe Comma::DataExtractor do # rubocop:disable Metrics/BlockLength
|
|
|
19
19
|
|
|
20
20
|
describe 'when no parameters are provided' do
|
|
21
21
|
it 'should use the string value returned by sending the method name on the object' do
|
|
22
|
-
@data.
|
|
22
|
+
expect(@data).to include('Language and Implementation')
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
describe 'when given a string description as a parameter' do
|
|
27
27
|
it 'should use the string value returned by sending the method name on the object' do
|
|
28
|
-
@data.
|
|
28
|
+
expect(@data).to include('Smalltalk-80')
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
describe 'when an hash is passed as a parameter' do
|
|
33
33
|
describe 'with a string value' do
|
|
34
34
|
it 'should use the string value, returned by sending the hash key to the object' do
|
|
35
|
-
@data.
|
|
36
|
-
@data.
|
|
35
|
+
expect(@data).to include('123123123')
|
|
36
|
+
expect(@data).to include('321321321')
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it 'should not fail when an associated object is nil' do
|
|
40
|
-
|
|
40
|
+
expect { Book.new('Smalltalk-80', 'Language and Implementation', nil).to_comma }.not_to raise_error
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -53,7 +53,7 @@ describe Comma::DataExtractor, 'id attribute' do
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
it 'id attribute should yield block' do
|
|
56
|
-
@data.
|
|
56
|
+
expect(@data).to include('42')
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -70,7 +70,7 @@ describe Comma::DataExtractor, 'with static column method' do
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
it 'should extract headers' do
|
|
73
|
-
@data.
|
|
73
|
+
expect(@data).to eq([nil, nil, '', 'John Doe'])
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
@@ -86,6 +86,6 @@ describe Comma::DataExtractor, 'nil value' do
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
it 'should extract nil' do
|
|
89
|
-
@data.
|
|
89
|
+
expect(@data).to eq([nil, nil, nil])
|
|
90
90
|
end
|
|
91
91
|
end
|
|
@@ -19,26 +19,26 @@ describe Comma::HeaderExtractor do # rubocop:disable Metrics/BlockLength
|
|
|
19
19
|
|
|
20
20
|
describe 'when no parameters are provided' do
|
|
21
21
|
it 'should use the method name as the header name, humanized' do
|
|
22
|
-
@headers.
|
|
22
|
+
expect(@headers).to include('Description')
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
describe 'when given a string description as a parameter' do
|
|
27
27
|
it 'should use the string value, unmodified' do
|
|
28
|
-
@headers.
|
|
28
|
+
expect(@headers).to include('Title')
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
describe 'when an hash is passed as a parameter' do
|
|
33
33
|
describe 'with a string value' do
|
|
34
34
|
it 'should use the string value, unmodified' do
|
|
35
|
-
@headers.
|
|
35
|
+
expect(@headers).to include('ISBN-10')
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
describe 'with a non-string value' do
|
|
40
40
|
it 'should use the non string value converted to a string, humanized' do
|
|
41
|
-
@headers.
|
|
41
|
+
expect(@headers).to include('Issuer')
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -56,6 +56,6 @@ describe Comma::HeaderExtractor, 'with static column method' do
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
it 'should extract headers' do
|
|
59
|
-
@headers.
|
|
59
|
+
expect(@headers).to eq(['', 'STATIC', 'STATIC'])
|
|
60
60
|
end
|
|
61
61
|
end
|
|
@@ -79,25 +79,25 @@ if defined? ActiveRecord
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
describe '#to_comma on scopes' do
|
|
82
|
-
it 'should extend ActiveRecord::NamedScope::Scope to add a #to_comma method which will return CSV content for objects within the scope' do # rubocop:disable
|
|
83
|
-
Person.teenagers.to_comma.
|
|
82
|
+
it 'should extend ActiveRecord::NamedScope::Scope to add a #to_comma method which will return CSV content for objects within the scope' do # rubocop:disable Metrics/LineLength
|
|
83
|
+
expect(Person.teenagers.to_comma).to eq "Name,Age\nJunior,18\n"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it 'should find in batches' do
|
|
87
87
|
scope = Person.teenagers
|
|
88
|
-
scope.
|
|
88
|
+
expect(scope).to receive(:find_each).and_yield @person
|
|
89
89
|
scope.to_comma
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
it 'should fall back to iterating with each when scope has limit clause' do
|
|
93
93
|
scope = Person.limit(1)
|
|
94
|
-
scope.
|
|
94
|
+
expect(scope).to receive(:each).and_yield @person
|
|
95
95
|
scope.to_comma
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
it 'should fall back to iterating with each when scope has order clause' do
|
|
99
99
|
scope = Person.order(:age)
|
|
100
|
-
scope.
|
|
100
|
+
expect(scope).to receive(:each).and_yield @person
|
|
101
101
|
scope.to_comma
|
|
102
102
|
end
|
|
103
103
|
end
|
|
@@ -126,31 +126,30 @@ if defined? ActiveRecord
|
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
it 'should i18n-ize header values' do
|
|
129
|
-
Person.teenagers.to_comma.
|
|
129
|
+
expect(Person.teenagers.to_comma).to match(/^名前,年齢/)
|
|
130
130
|
end
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
describe 'github issue 75' do
|
|
134
134
|
it 'should find association' do
|
|
135
|
-
|
|
135
|
+
expect { Person.all.to_comma(:issue_75) }.not_to raise_error
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
describe 'with accessor' do
|
|
140
140
|
it 'should not raise exception' do
|
|
141
|
-
Job.all.to_comma.
|
|
141
|
+
expect(Job.all.to_comma).to eq("Name\nJunior\n")
|
|
142
142
|
end
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
describe 'github pull-request 83' do
|
|
146
146
|
it 'should not raise NameError' do
|
|
147
|
-
expect { Picture.all.to_comma(:pr_83) }
|
|
148
|
-
.not_to raise_exception(NameError)
|
|
147
|
+
expect { Picture.all.to_comma(:pr_83) }.not_to raise_error
|
|
149
148
|
end
|
|
150
149
|
end
|
|
151
150
|
end
|
|
152
151
|
|
|
153
|
-
describe Comma, 'generating CSV from an ActiveRecord object using Single Table Inheritance' do # rubocop:disable
|
|
152
|
+
describe Comma, 'generating CSV from an ActiveRecord object using Single Table Inheritance' do # rubocop:disable Metrics/BlockLength
|
|
154
153
|
class Animal < ActiveRecord::Base
|
|
155
154
|
comma do
|
|
156
155
|
name 'Name' do |name|
|
|
@@ -189,16 +188,16 @@ if defined? ActiveRecord
|
|
|
189
188
|
end
|
|
190
189
|
|
|
191
190
|
it 'should return and array of data content, as defined in comma block in child class' do
|
|
192
|
-
@dog.to_comma.
|
|
191
|
+
expect(@dog.to_comma).to eq %w[Dog-Rex]
|
|
193
192
|
end
|
|
194
193
|
|
|
195
194
|
# FIXME: this one is failing - the comma block from Dog is executed instead of the one from the super class
|
|
196
195
|
it 'should return and array of data content, as defined in comma block in super class, if not present in child' do
|
|
197
|
-
@cat.to_comma.
|
|
196
|
+
expect(@cat.to_comma).to eq %w[Super-Kitty]
|
|
198
197
|
end
|
|
199
198
|
|
|
200
199
|
it 'should call definion in parent class' do
|
|
201
|
-
|
|
200
|
+
expect { @dog.to_comma(:with_type) }.not_to raise_error
|
|
202
201
|
end
|
|
203
202
|
end
|
|
204
203
|
end
|
|
@@ -10,7 +10,7 @@ if defined?(Rails)
|
|
|
10
10
|
mock_users = [mock_model(User), mock_model(User)]
|
|
11
11
|
allow(User).to receive(:all).and_return(mock_users)
|
|
12
12
|
|
|
13
|
-
mock_users.
|
|
13
|
+
expect(mock_users).to receive(:to_comma).once
|
|
14
14
|
|
|
15
15
|
get :index, format: :csv
|
|
16
16
|
end
|
|
@@ -25,17 +25,17 @@ if defined?(Rails)
|
|
|
25
25
|
it 'should not affect html requested' do
|
|
26
26
|
get :index
|
|
27
27
|
|
|
28
|
-
response.status.
|
|
29
|
-
response.
|
|
30
|
-
response.body.
|
|
28
|
+
expect(response.status).to eq 200
|
|
29
|
+
expect(response.media_type).to eq 'text/html'
|
|
30
|
+
expect(response.body).to eq 'Users!'
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it 'should return a csv when requested' do
|
|
34
34
|
get :index, format: :csv
|
|
35
35
|
|
|
36
|
-
response.status.
|
|
37
|
-
response.
|
|
38
|
-
response.header['Content-Disposition'].
|
|
36
|
+
expect(response.status).to eq 200
|
|
37
|
+
expect(response.media_type).to eq 'text/csv'
|
|
38
|
+
expect(response.header['Content-Disposition']).to include('filename="data.csv"')
|
|
39
39
|
|
|
40
40
|
expected_content = <<-CSV.gsub(/^\s+/, '')
|
|
41
41
|
First name,Last name,Name
|
|
@@ -43,7 +43,7 @@ if defined?(Rails)
|
|
|
43
43
|
Wilma,Flintstone,Wilma Flintstone
|
|
44
44
|
CSV
|
|
45
45
|
|
|
46
|
-
response.body.
|
|
46
|
+
expect(response.body).to eq expected_content
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
describe 'with comma options' do
|
|
@@ -59,7 +59,7 @@ if defined?(Rails)
|
|
|
59
59
|
Wilma,Flintstone
|
|
60
60
|
CSV
|
|
61
61
|
|
|
62
|
-
response.body.
|
|
62
|
+
expect(response.body).to eq expected_content
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -79,9 +79,9 @@ if defined?(Rails)
|
|
|
79
79
|
it 'should allow a filename to be set' do
|
|
80
80
|
get_ :with_custom_options, format: :csv, params: { custom_options: { filename: 'my_custom_name' } }
|
|
81
81
|
|
|
82
|
-
response.status.
|
|
83
|
-
response.
|
|
84
|
-
response.header['Content-Disposition'].
|
|
82
|
+
expect(response.status).to eq 200
|
|
83
|
+
expect(response.media_type).to eq 'text/csv'
|
|
84
|
+
expect(response.header['Content-Disposition']).to include('filename="my_custom_name.csv"')
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
it 'should allow a custom filename with spaces' do
|
|
@@ -89,35 +89,47 @@ if defined?(Rails)
|
|
|
89
89
|
params = { custom_options: { filename: 'filename with a lot of spaces' } }
|
|
90
90
|
get_ :with_custom_options, format: :csv, params: params
|
|
91
91
|
|
|
92
|
-
response.status.
|
|
93
|
-
response.
|
|
94
|
-
response.header['Content-Disposition'].
|
|
92
|
+
expect(response.status).to eq 200
|
|
93
|
+
expect(response.media_type).to eq 'text/csv'
|
|
94
|
+
expect(response.header['Content-Disposition']).to include('filename="filename with a lot of spaces.csv"')
|
|
95
95
|
|
|
96
96
|
filename_string = response.header['Content-Disposition'].split('=').last
|
|
97
97
|
# shellsplit honors quoted strings
|
|
98
|
-
filename_string.shellsplit.length.
|
|
98
|
+
expect(filename_string.shellsplit.length).to eq 1
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
it 'should allow a file extension to be set' do
|
|
102
102
|
get_ :with_custom_options, format: :csv, params: { custom_options: { extension: :txt } }
|
|
103
103
|
|
|
104
|
-
response.status.
|
|
105
|
-
response.
|
|
106
|
-
response.header['Content-Disposition'].
|
|
104
|
+
expect(response.status).to eq 200
|
|
105
|
+
expect(response.media_type).to eq 'text/csv'
|
|
106
|
+
expect(response.header['Content-Disposition']).to include('filename="data.txt"')
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
it 'should allow mime type to be set' do
|
|
110
110
|
get_ :with_custom_options, format: :csv, params: { custom_options: { mime_type: 'text/plain' } }
|
|
111
|
-
response.status.
|
|
112
|
-
response.
|
|
111
|
+
expect(response.status).to eq 200
|
|
112
|
+
expect(response.media_type).to eq 'text/plain'
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it 'should allow bom to be set' do
|
|
116
|
+
get_ :with_custom_options, format: :csv, params: { custom_options: { with_bom: true } }
|
|
117
|
+
|
|
118
|
+
expected_content = <<-CSV.gsub(/^\s+/, '')
|
|
119
|
+
\xEF\xBB\xBFFirst name,Last name,Name
|
|
120
|
+
Fred,Flintstone,Fred Flintstone
|
|
121
|
+
Wilma,Flintstone,Wilma Flintstone
|
|
122
|
+
CSV
|
|
123
|
+
|
|
124
|
+
expect(response.body). to eq expected_content
|
|
113
125
|
end
|
|
114
126
|
|
|
115
127
|
describe 'headers' do
|
|
116
128
|
it 'should allow toggling on' do
|
|
117
129
|
get_ :with_custom_options, format: :csv, params: { custom_options: { write_headers: 'true' } }
|
|
118
130
|
|
|
119
|
-
response.status.
|
|
120
|
-
response.
|
|
131
|
+
expect(response.status).to eq 200
|
|
132
|
+
expect(response.media_type).to eq 'text/csv'
|
|
121
133
|
|
|
122
134
|
expected_content = <<-CSV.gsub(/^\s+/, '')
|
|
123
135
|
First name,Last name,Name
|
|
@@ -125,29 +137,29 @@ if defined?(Rails)
|
|
|
125
137
|
Wilma,Flintstone,Wilma Flintstone
|
|
126
138
|
CSV
|
|
127
139
|
|
|
128
|
-
response.body.
|
|
140
|
+
expect(response.body).to eq expected_content
|
|
129
141
|
end
|
|
130
142
|
|
|
131
143
|
it 'should allow toggling off' do
|
|
132
144
|
get_ :with_custom_options, format: :csv, params: { custom_options: { write_headers: false } }
|
|
133
145
|
|
|
134
|
-
response.status.
|
|
135
|
-
response.
|
|
146
|
+
expect(response.status).to eq 200
|
|
147
|
+
expect(response.media_type).to eq 'text/csv'
|
|
136
148
|
|
|
137
149
|
expected_content = <<-CSV.gsub(/^\s+/, '')
|
|
138
150
|
Fred,Flintstone,Fred Flintstone
|
|
139
151
|
Wilma,Flintstone,Wilma Flintstone
|
|
140
152
|
CSV
|
|
141
153
|
|
|
142
|
-
response.body.
|
|
154
|
+
expect(response.body).to eq expected_content
|
|
143
155
|
end
|
|
144
156
|
end
|
|
145
157
|
|
|
146
158
|
it 'should allow forcing of quotes' do
|
|
147
159
|
get_ :with_custom_options, format: :csv, params: { custom_options: { force_quotes: true } }
|
|
148
160
|
|
|
149
|
-
response.status.
|
|
150
|
-
response.
|
|
161
|
+
expect(response.status).to eq 200
|
|
162
|
+
expect(response.media_type).to eq 'text/csv'
|
|
151
163
|
|
|
152
164
|
expected_content = <<-CSV.gsub(/^\s+/, '')
|
|
153
165
|
"First name","Last name","Name"
|
|
@@ -155,7 +167,7 @@ if defined?(Rails)
|
|
|
155
167
|
"Wilma","Flintstone","Wilma Flintstone"
|
|
156
168
|
CSV
|
|
157
169
|
|
|
158
|
-
response.body.
|
|
170
|
+
expect(response.body).to eq expected_content
|
|
159
171
|
end
|
|
160
172
|
|
|
161
173
|
it 'should allow combinations of options' do
|
|
@@ -169,15 +181,15 @@ if defined?(Rails)
|
|
|
169
181
|
}
|
|
170
182
|
get_ :with_custom_options, format: :csv, params: params
|
|
171
183
|
|
|
172
|
-
response.status.
|
|
173
|
-
response.
|
|
184
|
+
expect(response.status).to eq 200
|
|
185
|
+
expect(response.media_type).to eq 'text/csv'
|
|
174
186
|
|
|
175
187
|
expected_content = <<-CSV.gsub(/^\s+/, '')
|
|
176
188
|
"Fred"||"Flintstone"||"Fred Flintstone"ENDOFLINE
|
|
177
189
|
"Wilma"||"Flintstone"||"Wilma Flintstone"ENDOFLINE
|
|
178
190
|
CSV
|
|
179
191
|
|
|
180
|
-
response.body.
|
|
192
|
+
expect(response.body).to eq expected_content
|
|
181
193
|
end
|
|
182
194
|
end
|
|
183
195
|
end
|
|
@@ -28,14 +28,7 @@ class User < ActiveRecord::Base
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
if Rails::VERSION::STRING =~ /^[56].*/
|
|
33
|
-
ActiveRecord::Migration[4.2]
|
|
34
|
-
else
|
|
35
|
-
ActiveRecord::Migration
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
class CreateTables < MIGRATION_CLASS
|
|
31
|
+
class CreateTables < ActiveRecord::Migration[4.2]
|
|
39
32
|
def self.up
|
|
40
33
|
create_table :users do |t|
|
|
41
34
|
t.string :first_name
|
data/spec/spec_helper.rb
CHANGED
|
@@ -3,8 +3,21 @@
|
|
|
3
3
|
require 'rubygems'
|
|
4
4
|
$LOAD_PATH.unshift(File.expand_path(File.join('..', '..', 'lib'), __FILE__))
|
|
5
5
|
|
|
6
|
+
require 'simplecov'
|
|
6
7
|
require 'coveralls'
|
|
7
|
-
Coveralls
|
|
8
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
|
9
|
+
if defined? Rails
|
|
10
|
+
SimpleCov.start('rails') do
|
|
11
|
+
add_filter %r{^/spec/comma/rails/data_mapper_collection_spec\.rb$}
|
|
12
|
+
add_filter %r{^/spec/comma/rails/mongoid_spec\.rb$}
|
|
13
|
+
end
|
|
14
|
+
else
|
|
15
|
+
SimpleCov.start do
|
|
16
|
+
add_filter %r{^/spec/comma/rails/data_mapper_collection_spec\.rb}
|
|
17
|
+
add_filter %r{^/spec/comma/rails/mongoid_spec\.rb}
|
|
18
|
+
add_filter %r{^/spec/controllers/}
|
|
19
|
+
end
|
|
20
|
+
end
|
|
8
21
|
|
|
9
22
|
require 'bundler/setup'
|
|
10
23
|
Bundler.require
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: comma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcus Crafter
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2021-12-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -18,9 +18,6 @@ dependencies:
|
|
|
18
18
|
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
20
|
version: 4.2.0
|
|
21
|
-
- - "<"
|
|
22
|
-
- !ruby/object:Gem::Version
|
|
23
|
-
version: '6.1'
|
|
24
21
|
type: :runtime
|
|
25
22
|
prerelease: false
|
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -28,9 +25,6 @@ dependencies:
|
|
|
28
25
|
- - ">="
|
|
29
26
|
- !ruby/object:Gem::Version
|
|
30
27
|
version: 4.2.0
|
|
31
|
-
- - "<"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '6.1'
|
|
34
28
|
- !ruby/object:Gem::Dependency
|
|
35
29
|
name: appraisal
|
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -45,20 +39,34 @@ dependencies:
|
|
|
45
39
|
- - "~>"
|
|
46
40
|
- !ruby/object:Gem::Version
|
|
47
41
|
version: 1.0.0
|
|
42
|
+
- !ruby/object:Gem::Dependency
|
|
43
|
+
name: minitest
|
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - '='
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: 5.14.4
|
|
49
|
+
type: :development
|
|
50
|
+
prerelease: false
|
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
+
requirements:
|
|
53
|
+
- - '='
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: 5.14.4
|
|
48
56
|
- !ruby/object:Gem::Dependency
|
|
49
57
|
name: rake
|
|
50
58
|
requirement: !ruby/object:Gem::Requirement
|
|
51
59
|
requirements:
|
|
52
60
|
- - "~>"
|
|
53
61
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
62
|
+
version: 13.0.1
|
|
55
63
|
type: :development
|
|
56
64
|
prerelease: false
|
|
57
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
58
66
|
requirements:
|
|
59
67
|
- - "~>"
|
|
60
68
|
- !ruby/object:Gem::Version
|
|
61
|
-
version:
|
|
69
|
+
version: 13.0.1
|
|
62
70
|
- !ruby/object:Gem::Dependency
|
|
63
71
|
name: rspec
|
|
64
72
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -101,20 +109,6 @@ dependencies:
|
|
|
101
109
|
- - ">="
|
|
102
110
|
- !ruby/object:Gem::Version
|
|
103
111
|
version: '0'
|
|
104
|
-
- !ruby/object:Gem::Dependency
|
|
105
|
-
name: sqlite3
|
|
106
|
-
requirement: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - "~>"
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: 1.3.11
|
|
111
|
-
type: :development
|
|
112
|
-
prerelease: false
|
|
113
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - "~>"
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: 1.3.11
|
|
118
112
|
description: Ruby Comma Seperated Values generation library
|
|
119
113
|
email:
|
|
120
114
|
- crafterm@redartisan.com
|
|
@@ -124,6 +118,7 @@ extensions: []
|
|
|
124
118
|
extra_rdoc_files: []
|
|
125
119
|
files:
|
|
126
120
|
- ".coveralls.yml"
|
|
121
|
+
- ".github/workflows/build.yml"
|
|
127
122
|
- ".gitignore"
|
|
128
123
|
- ".rspec"
|
|
129
124
|
- ".rubocop.yml"
|
|
@@ -136,26 +131,22 @@ files:
|
|
|
136
131
|
- README.md
|
|
137
132
|
- Rakefile
|
|
138
133
|
- comma.gemspec
|
|
139
|
-
- gemfiles/
|
|
140
|
-
- gemfiles/
|
|
141
|
-
- gemfiles/
|
|
142
|
-
- gemfiles/
|
|
143
|
-
- gemfiles/
|
|
144
|
-
- gemfiles/
|
|
145
|
-
- gemfiles/
|
|
146
|
-
- gemfiles/
|
|
147
|
-
- gemfiles/
|
|
148
|
-
- gemfiles/
|
|
149
|
-
- gemfiles/
|
|
150
|
-
- gemfiles/
|
|
151
|
-
- gemfiles/
|
|
152
|
-
- gemfiles/
|
|
153
|
-
- gemfiles/
|
|
154
|
-
- gemfiles/
|
|
155
|
-
- gemfiles/rails5.2.3.gemfile
|
|
156
|
-
- gemfiles/rails5.2.3.gemfile.lock
|
|
157
|
-
- gemfiles/rails6.0.0.gemfile
|
|
158
|
-
- gemfiles/rails6.0.0.gemfile.lock
|
|
134
|
+
- gemfiles/active5.2.5.gemfile
|
|
135
|
+
- gemfiles/active5.2.5.gemfile.lock
|
|
136
|
+
- gemfiles/active6.0.3.6.gemfile
|
|
137
|
+
- gemfiles/active6.0.3.6.gemfile.lock
|
|
138
|
+
- gemfiles/active6.1.3.1.gemfile
|
|
139
|
+
- gemfiles/active6.1.3.1.gemfile.lock
|
|
140
|
+
- gemfiles/active7.0.0.gemfile
|
|
141
|
+
- gemfiles/active7.0.0.gemfile.lock
|
|
142
|
+
- gemfiles/rails5.2.5.gemfile
|
|
143
|
+
- gemfiles/rails5.2.5.gemfile.lock
|
|
144
|
+
- gemfiles/rails6.0.3.6.gemfile
|
|
145
|
+
- gemfiles/rails6.0.3.6.gemfile.lock
|
|
146
|
+
- gemfiles/rails6.1.3.1.gemfile
|
|
147
|
+
- gemfiles/rails6.1.3.1.gemfile.lock
|
|
148
|
+
- gemfiles/rails7.0.0.gemfile
|
|
149
|
+
- gemfiles/rails7.0.0.gemfile.lock
|
|
159
150
|
- init.rb
|
|
160
151
|
- lib/comma.rb
|
|
161
152
|
- lib/comma/array.rb
|
|
@@ -202,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
202
193
|
- !ruby/object:Gem::Version
|
|
203
194
|
version: '0'
|
|
204
195
|
requirements: []
|
|
205
|
-
rubygems_version: 3.
|
|
196
|
+
rubygems_version: 3.1.4
|
|
206
197
|
signing_key:
|
|
207
198
|
specification_version: 4
|
|
208
199
|
summary: Ruby Comma Seperated Values generation library
|