trick_bag 0.46.0 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE_NOTES.md +5 -0
- data/lib/trick_bag/formatters/formatters.rb +2 -11
- data/lib/trick_bag/version.rb +1 -1
- data/spec/trick_bag/formatters/formatters_spec.rb +1 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d01ca3cfe583081305fb5ab8275177ae10dae944
|
4
|
+
data.tar.gz: 53a75fcdec73d0ef74ef6c5e95d68a78661da520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 947ec282b463b2a1916ef64735bc585a1d9956c76fceebea3c0c8b0112659499a5374a7ad578837eb5d80a3c4be5f63bdf6d5cf483a189a670e10b18d93417f0
|
7
|
+
data.tar.gz: 098840c716d1ecab47b56f663640551d412e3dc9c304f7efec8f56c6a4759f33de0f189e8ece115e2b5a98060449d26929548798f193d364e2f7c5bc71889c19
|
data/RELEASE_NOTES.md
CHANGED
@@ -123,22 +123,13 @@ module Formatters
|
|
123
123
|
end
|
124
124
|
|
125
125
|
|
126
|
-
# Returns a string representation of the array as would be output by puts,
|
127
|
-
# one line per element.
|
128
|
-
def array_as_multiline_string(array)
|
129
|
-
sio = StringIO.new
|
130
|
-
sio.puts(array)
|
131
|
-
sio.string
|
132
|
-
end
|
133
|
-
|
134
|
-
|
135
126
|
# Shows a visual diff of 2 arrays by comparing the string representations
|
136
127
|
# of the arrays with one element per line.
|
137
128
|
# @param format can be any valid Diffy option, e.g. :color
|
138
129
|
# see https://github.com/samg/diffy/blob/master/lib/diffy/format.rb
|
139
130
|
def array_diff(array1, array2, format = :text)
|
140
|
-
string1 =
|
141
|
-
string2 =
|
131
|
+
string1 = array1.join("\n") + "\n"
|
132
|
+
string2 = array2.join("\n") + "\n"
|
142
133
|
Diffy::Diff.new(string1, string2).to_s(format)
|
143
134
|
end
|
144
135
|
|
data/lib/trick_bag/version.rb
CHANGED
@@ -124,29 +124,13 @@ describe Formatters do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
|
127
|
-
context 'array_as_multiline_string' do
|
128
|
-
specify 'string representation is correct when array is NOT empty' do
|
129
|
-
array = [1, 2, 3]
|
130
|
-
expect(Formatters.array_as_multiline_string(array)).to eq("1\n2\n3\n")
|
131
|
-
end
|
132
|
-
|
133
|
-
specify 'string representation is correct when array is empty' do
|
134
|
-
array = []
|
135
|
-
expect(Formatters.array_as_multiline_string(array)).to eq("")
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
|
140
127
|
context 'array_diff' do
|
141
128
|
specify 'text is correct' do
|
142
129
|
a1 = [1, 2, 3]
|
143
130
|
a2 = [ 2, 3, 4]
|
144
|
-
actual_text = Formatters.array_diff(a1, a2
|
131
|
+
actual_text = Formatters.array_diff(a1, a2)
|
145
132
|
expected_text = "-1\n 2\n 3\n+4\n"
|
146
133
|
expect(actual_text).to eq(expected_text)
|
147
|
-
puts
|
148
|
-
puts actual_text
|
149
|
-
puts
|
150
134
|
end
|
151
135
|
end
|
152
136
|
end
|