iostreams 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +7 -7
- data/lib/io_streams/builder.rb +4 -3
- data/lib/io_streams/bzip2/reader.rb +1 -1
- data/lib/io_streams/bzip2/writer.rb +1 -1
- data/lib/io_streams/deprecated.rb +2 -3
- data/lib/io_streams/encode/reader.rb +5 -8
- data/lib/io_streams/encode/writer.rb +1 -1
- data/lib/io_streams/io_streams.rb +5 -2
- data/lib/io_streams/line/reader.rb +2 -1
- data/lib/io_streams/path.rb +4 -4
- data/lib/io_streams/paths/http.rb +8 -10
- data/lib/io_streams/paths/matcher.rb +10 -11
- data/lib/io_streams/paths/s3.rb +6 -6
- data/lib/io_streams/paths/sftp.rb +38 -23
- data/lib/io_streams/pgp.rb +45 -35
- data/lib/io_streams/pgp/reader.rb +4 -6
- data/lib/io_streams/pgp/writer.rb +1 -2
- data/lib/io_streams/reader.rb +2 -2
- data/lib/io_streams/record/writer.rb +2 -4
- data/lib/io_streams/row/writer.rb +3 -5
- data/lib/io_streams/stream.rb +6 -6
- data/lib/io_streams/symmetric_encryption/reader.rb +1 -3
- data/lib/io_streams/symmetric_encryption/writer.rb +2 -6
- data/lib/io_streams/tabular.rb +12 -10
- data/lib/io_streams/tabular/header.rb +4 -4
- data/lib/io_streams/tabular/parser/array.rb +2 -4
- data/lib/io_streams/tabular/parser/csv.rb +3 -5
- data/lib/io_streams/tabular/parser/fixed.rb +4 -3
- data/lib/io_streams/tabular/parser/hash.rb +2 -4
- data/lib/io_streams/tabular/parser/json.rb +2 -4
- data/lib/io_streams/tabular/parser/psv.rb +5 -7
- data/lib/io_streams/tabular/utility/csv_row.rb +9 -17
- data/lib/io_streams/utils.rb +3 -3
- data/lib/io_streams/utils/reliable_http.rb +98 -0
- data/lib/io_streams/version.rb +1 -1
- data/lib/io_streams/writer.rb +1 -1
- data/lib/io_streams/xlsx/reader.rb +5 -5
- data/lib/io_streams/zip/reader.rb +1 -1
- data/lib/io_streams/zip/writer.rb +2 -2
- data/lib/iostreams.rb +34 -34
- data/test/builder_test.rb +74 -74
- data/test/bzip2_reader_test.rb +8 -13
- data/test/bzip2_writer_test.rb +8 -9
- data/test/deprecated_test.rb +25 -29
- data/test/encode_reader_test.rb +14 -18
- data/test/encode_writer_test.rb +29 -30
- data/test/gzip_reader_test.rb +8 -13
- data/test/gzip_writer_test.rb +10 -11
- data/test/io_streams_test.rb +35 -35
- data/test/line_reader_test.rb +35 -39
- data/test/line_writer_test.rb +8 -9
- data/test/minimal_file_reader.rb +1 -1
- data/test/path_test.rb +24 -24
- data/test/paths/file_test.rb +42 -42
- data/test/paths/http_test.rb +5 -5
- data/test/paths/matcher_test.rb +11 -12
- data/test/paths/s3_test.rb +44 -46
- data/test/paths/sftp_test.rb +18 -18
- data/test/pgp_reader_test.rb +13 -15
- data/test/pgp_test.rb +43 -44
- data/test/pgp_writer_test.rb +27 -28
- data/test/record_reader_test.rb +9 -10
- data/test/record_writer_test.rb +10 -11
- data/test/row_reader_test.rb +5 -6
- data/test/row_writer_test.rb +7 -8
- data/test/stream_test.rb +60 -62
- data/test/tabular_test.rb +111 -111
- data/test/test_helper.rb +22 -22
- data/test/utils_test.rb +7 -7
- data/test/xlsx_reader_test.rb +12 -12
- data/test/zip_reader_test.rb +14 -21
- data/test/zip_writer_test.rb +10 -10
- metadata +4 -3
data/test/tabular_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "test_helper"
|
2
2
|
|
3
3
|
class TabularTest < Minitest::Test
|
4
4
|
describe IOStreams::Tabular do
|
@@ -7,251 +7,251 @@ class TabularTest < Minitest::Test
|
|
7
7
|
end
|
8
8
|
|
9
9
|
let :tabular do
|
10
|
-
IOStreams::Tabular.new(columns: [
|
10
|
+
IOStreams::Tabular.new(columns: %w[first_field second third], format: format)
|
11
11
|
end
|
12
12
|
|
13
|
-
describe
|
14
|
-
it
|
13
|
+
describe "#parse_header" do
|
14
|
+
it "parses and sets the csv header" do
|
15
15
|
tabular = IOStreams::Tabular.new(format: :csv)
|
16
|
-
header = tabular.parse_header(
|
17
|
-
assert_equal [
|
16
|
+
header = tabular.parse_header("first field,Second,thirD")
|
17
|
+
assert_equal ["first field", "Second", "thirD"], header
|
18
18
|
assert_equal header, tabular.header.columns
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe
|
23
|
-
describe
|
24
|
-
it
|
25
|
-
tabular = IOStreams::Tabular.new(columns: [
|
22
|
+
describe "#cleanse_header!" do
|
23
|
+
describe "cleanses" do
|
24
|
+
it "a csv header" do
|
25
|
+
tabular = IOStreams::Tabular.new(columns: ["first field", "Second", "thirD"])
|
26
26
|
header = tabular.cleanse_header!
|
27
|
-
assert_equal [
|
27
|
+
assert_equal %w[first_field second third], header
|
28
28
|
assert_equal header, tabular.header.columns
|
29
29
|
end
|
30
30
|
|
31
|
-
it
|
32
|
-
tabular
|
33
|
-
columns: [
|
34
|
-
allowed_columns: %w
|
31
|
+
it "white listed snake cased alphanumeric columns" do
|
32
|
+
tabular = IOStreams::Tabular.new(
|
33
|
+
columns: ["Ard Vark", "password", "robot version", "$$$"],
|
34
|
+
allowed_columns: %w[ard_vark robot_version]
|
35
35
|
)
|
36
|
-
expected_header = [
|
36
|
+
expected_header = ["ard_vark", nil, "robot_version", nil]
|
37
37
|
cleansed_header = tabular.cleanse_header!
|
38
38
|
assert_equal(expected_header, cleansed_header)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
describe
|
42
|
+
describe "allowed_columns" do
|
43
43
|
before do
|
44
|
-
@allowed_columns = [
|
44
|
+
@allowed_columns = %w[first second third fourth fifth]
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
48
|
-
tabular = IOStreams::Tabular.new(columns: [
|
47
|
+
it "passes" do
|
48
|
+
tabular = IOStreams::Tabular.new(columns: [" first ", "Second", "thirD "], allowed_columns: @allowed_columns)
|
49
49
|
header = tabular.cleanse_header!
|
50
|
-
assert_equal [
|
50
|
+
assert_equal %w[first second third], header
|
51
51
|
assert_equal header, tabular.header.columns
|
52
52
|
assert_equal @allowed_columns, tabular.header.allowed_columns
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
56
|
-
tabular = IOStreams::Tabular.new(columns: [
|
55
|
+
it "nils columns not in the whitelist" do
|
56
|
+
tabular = IOStreams::Tabular.new(columns: [" first ", "Unknown Column", "thirD "], allowed_columns: @allowed_columns)
|
57
57
|
header = tabular.cleanse_header!
|
58
|
-
assert_equal [
|
58
|
+
assert_equal ["first", nil, "third"], header
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
62
|
-
tabular = IOStreams::Tabular.new(columns: [
|
61
|
+
it "raises exception for columns not in the whitelist" do
|
62
|
+
tabular = IOStreams::Tabular.new(columns: [" first ", "Unknown Column", "thirD "], allowed_columns: @allowed_columns, skip_unknown: false)
|
63
63
|
exc = assert_raises IOStreams::Errors::InvalidHeader do
|
64
64
|
tabular.cleanse_header!
|
65
65
|
end
|
66
|
-
assert_equal
|
66
|
+
assert_equal "Unknown columns after cleansing: Unknown Column", exc.message
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
70
|
-
required = [
|
71
|
-
tabular = IOStreams::Tabular.new(columns: [
|
69
|
+
it "raises exception missing required columns" do
|
70
|
+
required = %w[first second fifth]
|
71
|
+
tabular = IOStreams::Tabular.new(columns: [" first ", "Second", "thirD "], allowed_columns: @allowed_columns, required_columns: required)
|
72
72
|
exc = assert_raises IOStreams::Errors::InvalidHeader do
|
73
73
|
tabular.cleanse_header!
|
74
74
|
end
|
75
|
-
assert_equal
|
75
|
+
assert_equal "Missing columns after cleansing: fifth", exc.message
|
76
76
|
end
|
77
77
|
|
78
|
-
it
|
79
|
-
tabular = IOStreams::Tabular.new(columns: [
|
78
|
+
it "raises exception when no columns left" do
|
79
|
+
tabular = IOStreams::Tabular.new(columns: %w[one two three], allowed_columns: @allowed_columns)
|
80
80
|
exc = assert_raises IOStreams::Errors::InvalidHeader do
|
81
81
|
tabular.cleanse_header!
|
82
82
|
end
|
83
|
-
assert_equal
|
83
|
+
assert_equal "All columns are unknown after cleansing: one,two,three", exc.message
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
describe
|
89
|
-
describe
|
88
|
+
describe "#record_parse" do
|
89
|
+
describe ":array format" do
|
90
90
|
let :format do
|
91
91
|
:array
|
92
92
|
end
|
93
93
|
|
94
|
-
it
|
94
|
+
it "renders" do
|
95
95
|
assert hash = tabular.record_parse([1, 2, 3])
|
96
|
-
assert_equal({
|
96
|
+
assert_equal({"first_field" => 1, "second" => 2, "third" => 3}, hash)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
it
|
101
|
-
assert hash = tabular.record_parse(
|
102
|
-
assert_equal({
|
100
|
+
it "format :csv" do
|
101
|
+
assert hash = tabular.record_parse("1,2,3")
|
102
|
+
assert_equal({"first_field" => "1", "second" => "2", "third" => "3"}, hash)
|
103
103
|
end
|
104
104
|
|
105
|
-
describe
|
105
|
+
describe ":hash format" do
|
106
106
|
let :format do
|
107
107
|
:hash
|
108
108
|
end
|
109
109
|
|
110
|
-
it
|
111
|
-
assert hash = tabular.record_parse(
|
112
|
-
assert_equal({
|
110
|
+
it "renders" do
|
111
|
+
assert hash = tabular.record_parse("first_field" => 1, "second" => 2, "third" => 3)
|
112
|
+
assert_equal({"first_field" => 1, "second" => 2, "third" => 3}, hash)
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
describe
|
116
|
+
describe ":json format" do
|
117
117
|
let :format do
|
118
118
|
:json
|
119
119
|
end
|
120
120
|
|
121
|
-
it
|
121
|
+
it "renders" do
|
122
122
|
assert hash = tabular.record_parse('{"first_field":1,"second":2,"third":3}')
|
123
|
-
assert_equal({
|
123
|
+
assert_equal({"first_field" => 1, "second" => 2, "third" => 3}, hash)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
-
describe
|
127
|
+
describe ":psv format" do
|
128
128
|
let :format do
|
129
129
|
:psv
|
130
130
|
end
|
131
131
|
|
132
|
-
it
|
133
|
-
assert hash = tabular.record_parse(
|
134
|
-
assert_equal({
|
132
|
+
it "renders" do
|
133
|
+
assert hash = tabular.record_parse("1|2|3")
|
134
|
+
assert_equal({"first_field" => "1", "second" => "2", "third" => "3"}, hash)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
describe
|
138
|
+
describe ":fixed format" do
|
139
139
|
let :tabular do
|
140
140
|
layout = [
|
141
|
-
{key:
|
142
|
-
{key:
|
143
|
-
{key:
|
141
|
+
{key: "name", size: 23},
|
142
|
+
{key: "address", size: 40},
|
143
|
+
{key: "zip", size: 5}
|
144
144
|
]
|
145
145
|
IOStreams::Tabular.new(format: :fixed, format_options: {layout: layout})
|
146
146
|
end
|
147
147
|
|
148
|
-
it
|
149
|
-
assert hash = tabular.record_parse(
|
150
|
-
assert_equal({
|
148
|
+
it "parses to hash" do
|
149
|
+
assert hash = tabular.record_parse("Jack over there 34618")
|
150
|
+
assert_equal({"name" => "Jack", "address" => "over there", "zip" => "34618"}, hash)
|
151
151
|
end
|
152
152
|
|
153
|
-
it
|
153
|
+
it "parses short string" do
|
154
154
|
# TODO: Raise exception on lines that are too short?
|
155
|
-
assert hash = tabular.record_parse(
|
156
|
-
assert_equal({
|
155
|
+
assert hash = tabular.record_parse("Jack over th")
|
156
|
+
assert_equal({"name" => "Jack", "address" => "over th", "zip" => ""}, hash)
|
157
157
|
end
|
158
158
|
|
159
|
-
it
|
159
|
+
it "parses longer string" do
|
160
160
|
# TODO: Raise exception on lines that are too long?
|
161
|
-
assert hash = tabular.record_parse(
|
162
|
-
assert_equal({
|
161
|
+
assert hash = tabular.record_parse("Jack over there 34618........................................")
|
162
|
+
assert_equal({"name" => "Jack", "address" => "over there", "zip" => "34618"}, hash)
|
163
163
|
end
|
164
164
|
|
165
|
-
it
|
166
|
-
assert hash = tabular.record_parse(
|
167
|
-
assert_equal({
|
165
|
+
it "parses empty strings" do
|
166
|
+
assert hash = tabular.record_parse(" 34618")
|
167
|
+
assert_equal({"name" => "", "address" => "", "zip" => "34618"}, hash)
|
168
168
|
end
|
169
169
|
|
170
|
-
it
|
170
|
+
it "parses nil data as nil" do
|
171
171
|
refute tabular.record_parse(nil)
|
172
172
|
end
|
173
173
|
|
174
|
-
it
|
175
|
-
refute tabular.record_parse(
|
174
|
+
it "parses empty string as nil" do
|
175
|
+
refute tabular.record_parse("")
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
-
it
|
180
|
-
tabular.header.allowed_columns = [
|
179
|
+
it "skips columns not in the whitelist" do
|
180
|
+
tabular.header.allowed_columns = %w[first second third fourth fifth]
|
181
181
|
tabular.cleanse_header!
|
182
|
-
assert hash = tabular.record_parse(
|
183
|
-
assert_equal({
|
182
|
+
assert hash = tabular.record_parse("1,2,3")
|
183
|
+
assert_equal({"second" => "2", "third" => "3"}, hash)
|
184
184
|
end
|
185
185
|
|
186
|
-
it
|
187
|
-
assert hash = tabular.record_parse(
|
188
|
-
assert_equal({
|
186
|
+
it "handles missing values" do
|
187
|
+
assert hash = tabular.record_parse("1,2")
|
188
|
+
assert_equal({"first_field" => "1", "second" => "2", "third" => nil}, hash)
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
|
-
describe
|
193
|
-
it
|
192
|
+
describe "#render" do
|
193
|
+
it "renders an array of values" do
|
194
194
|
assert csv_string = tabular.render([5, 6, 9])
|
195
|
-
assert_equal
|
195
|
+
assert_equal "5,6,9", csv_string
|
196
196
|
end
|
197
197
|
|
198
|
-
it
|
199
|
-
assert csv_string = tabular.render({
|
200
|
-
assert_equal
|
198
|
+
it "renders a hash" do
|
199
|
+
assert csv_string = tabular.render({"third" => "3", "first_field" => "1"})
|
200
|
+
assert_equal "1,,3", csv_string
|
201
201
|
end
|
202
202
|
|
203
|
-
it
|
204
|
-
assert csv_string = tabular.render({
|
205
|
-
assert_equal
|
203
|
+
it "renders a hash including nil and boolean" do
|
204
|
+
assert csv_string = tabular.render({"third" => true, "first_field" => false, "second" => nil})
|
205
|
+
assert_equal "false,,true", csv_string
|
206
206
|
end
|
207
207
|
|
208
|
-
describe
|
208
|
+
describe ":psv format" do
|
209
209
|
let :format do
|
210
210
|
:psv
|
211
211
|
end
|
212
212
|
|
213
|
-
it
|
214
|
-
assert psv_string = tabular.render({
|
215
|
-
assert_equal
|
213
|
+
it "renders psv nil and boolean" do
|
214
|
+
assert psv_string = tabular.render({"third" => true, "first_field" => false, "second" => nil})
|
215
|
+
assert_equal "false||true", psv_string
|
216
216
|
end
|
217
217
|
|
218
|
-
it
|
219
|
-
assert psv_string = tabular.render({
|
220
|
-
assert_equal
|
218
|
+
it "renders psv numeric and pipe data" do
|
219
|
+
assert psv_string = tabular.render({"third" => 23, "first_field" => "a|b|c", "second" => "|"})
|
220
|
+
assert_equal "a:b:c|:|23", psv_string
|
221
221
|
end
|
222
222
|
end
|
223
223
|
|
224
|
-
describe
|
224
|
+
describe ":fixed format" do
|
225
225
|
let :tabular do
|
226
226
|
layout = [
|
227
|
-
{key:
|
228
|
-
{key:
|
229
|
-
{key:
|
227
|
+
{key: "name", size: 23},
|
228
|
+
{key: "address", size: 40},
|
229
|
+
{key: "zip", size: 5}
|
230
230
|
]
|
231
231
|
IOStreams::Tabular.new(format: :fixed, format_options: {layout: layout})
|
232
232
|
end
|
233
233
|
|
234
|
-
it
|
235
|
-
assert string = tabular.render({
|
236
|
-
assert_equal
|
234
|
+
it "renders fixed data" do
|
235
|
+
assert string = tabular.render({"name" => "Jack", "address" => "over there", "zip" => 34_618, "phone" => "5551231234"})
|
236
|
+
assert_equal "Jack over there 34618", string
|
237
237
|
end
|
238
238
|
|
239
|
-
it
|
240
|
-
assert string = tabular.render({
|
241
|
-
assert_equal
|
239
|
+
it "truncates long data" do
|
240
|
+
assert string = tabular.render({"name" => "Jack", "address" => "over there", "zip" => 3_461_832_653_653_265, "phone" => "5551231234"})
|
241
|
+
assert_equal "Jack over there 34618", string
|
242
242
|
end
|
243
243
|
|
244
|
-
it
|
245
|
-
assert string = tabular.render(
|
246
|
-
assert_equal
|
244
|
+
it "renders nil as empty string" do
|
245
|
+
assert string = tabular.render("zip" => 3_461_832_653_653_265)
|
246
|
+
assert_equal " 34618", string
|
247
247
|
end
|
248
248
|
|
249
|
-
it
|
250
|
-
assert string = tabular.render({
|
251
|
-
assert_equal
|
249
|
+
it "renders boolean" do
|
250
|
+
assert string = tabular.render({"name" => true, "address" => false, "zip" => nil, "phone" => "5551231234"})
|
251
|
+
assert_equal "true false ", string
|
252
252
|
end
|
253
253
|
|
254
|
-
it
|
254
|
+
it "renders no data as nil" do
|
255
255
|
refute tabular.render({})
|
256
256
|
end
|
257
257
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) +
|
1
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
3
|
+
require "yaml"
|
4
|
+
require "minitest/autorun"
|
5
|
+
require "minitest/reporters"
|
6
|
+
require "iostreams"
|
7
|
+
require "awesome_print"
|
8
|
+
require "symmetric-encryption"
|
9
9
|
|
10
10
|
# Since PGP libraries use UTC for Dates
|
11
|
-
ENV[
|
11
|
+
ENV["TZ"] = "UTC"
|
12
12
|
|
13
13
|
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
14
14
|
|
15
15
|
# Test cipher
|
16
16
|
SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(
|
17
|
-
cipher_name:
|
18
|
-
key:
|
19
|
-
iv:
|
17
|
+
cipher_name: "aes-128-cbc",
|
18
|
+
key: "1234567890ABCDEF1234567890ABCDEF",
|
19
|
+
iv: "1234567890ABCDEF",
|
20
20
|
encoding: :base64strict
|
21
21
|
)
|
22
22
|
|
23
|
-
#IOStreams::Pgp.logger = Logger.new($stdout)
|
24
|
-
#IOStreams::Pgp.executable = 'gpg1'
|
23
|
+
# IOStreams::Pgp.logger = Logger.new($stdout)
|
24
|
+
# IOStreams::Pgp.executable = 'gpg1'
|
25
25
|
|
26
26
|
# Test PGP Keys
|
27
|
-
unless IOStreams::Pgp.
|
28
|
-
puts
|
29
|
-
IOStreams::Pgp.generate_key(name:
|
27
|
+
unless IOStreams::Pgp.key?(email: "sender@example.org")
|
28
|
+
puts "Generating test PGP key: sender@example.org"
|
29
|
+
IOStreams::Pgp.generate_key(name: "Sender", email: "sender@example.org", passphrase: "sender_passphrase", key_length: 2048)
|
30
30
|
end
|
31
|
-
unless IOStreams::Pgp.
|
32
|
-
puts
|
33
|
-
IOStreams::Pgp.generate_key(name:
|
31
|
+
unless IOStreams::Pgp.key?(email: "receiver@example.org")
|
32
|
+
puts "Generating test PGP key: receiver@example.org"
|
33
|
+
IOStreams::Pgp.generate_key(name: "Receiver", email: "receiver@example.org", passphrase: "receiver_passphrase", key_length: 2048)
|
34
34
|
end
|
35
35
|
|
36
36
|
# Test paths
|
37
|
-
root = File.expand_path(File.join(__dir__,
|
38
|
-
IOStreams.add_root(:default, File.join(root,
|
39
|
-
IOStreams.add_root(:downloads, File.join(root,
|
37
|
+
root = File.expand_path(File.join(__dir__, "../tmp"))
|
38
|
+
IOStreams.add_root(:default, File.join(root, "default"))
|
39
|
+
IOStreams.add_root(:downloads, File.join(root, "downloads"))
|
data/test/utils_test.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "test_helper"
|
2
2
|
|
3
3
|
class UtilsTest < Minitest::Test
|
4
4
|
describe IOStreams::Utils do
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
result = IOStreams::Utils.temp_file_name(
|
5
|
+
describe ".temp_file_name" do
|
6
|
+
it "returns value from block" do
|
7
|
+
result = IOStreams::Utils.temp_file_name("base", ".ext") { |_name| 257 }
|
8
8
|
assert_equal 257, result
|
9
9
|
end
|
10
10
|
|
11
|
-
it
|
11
|
+
it "supplies new temp file_name" do
|
12
12
|
file_name = nil
|
13
13
|
file_name2 = nil
|
14
|
-
IOStreams::Utils.temp_file_name(
|
15
|
-
IOStreams::Utils.temp_file_name(
|
14
|
+
IOStreams::Utils.temp_file_name("base", ".ext") { |name| file_name = name }
|
15
|
+
IOStreams::Utils.temp_file_name("base", ".ext") { |name| file_name2 = name }
|
16
16
|
refute_equal file_name, file_name2
|
17
17
|
end
|
18
18
|
end
|