assert_same 0.7.2 → 0.7.3
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.
- data/assert_same.gemspec +1 -1
- data/lib/assert_same.rb +6 -7
- metadata +2 -2
data/assert_same.gemspec
CHANGED
data/lib/assert_same.rb
CHANGED
@@ -66,10 +66,9 @@ end
|
|
66
66
|
|
67
67
|
test_unit_module.module_eval do
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
class_variable_set(:@@file_offsets, Hash.new { |hash, key| hash[key] = {} })
|
69
|
+
def file_offsets
|
70
|
+
@file_offsets ||= Hash.new { |hash, key| hash[key] = {} }
|
71
|
+
end
|
73
72
|
|
74
73
|
# assert_same: assert which checks that two strings (expected and actual) are same
|
75
74
|
# and which can "magically" replace expected value with the actual in case
|
@@ -300,8 +299,8 @@ private
|
|
300
299
|
source = File.readlines(File::expand_path(file))
|
301
300
|
|
302
301
|
# file may be changed by previous accepted assert_same's, adjust line numbers
|
303
|
-
offset =
|
304
|
-
line.to_i >= i ? sum +
|
302
|
+
offset = file_offsets[file].keys.inject(0) do |sum, i|
|
303
|
+
line.to_i >= i ? sum + file_offsets[file][i] : sum
|
305
304
|
end
|
306
305
|
|
307
306
|
expected_text_end_line = expected_text_start_line = line.to_i + offset
|
@@ -339,7 +338,7 @@ private
|
|
339
338
|
# recalculate line number adjustments
|
340
339
|
actual_length = actual.split("\n").length
|
341
340
|
actual_length += 1 if change == :create_expected_string # END marker after expected value
|
342
|
-
|
341
|
+
file_offsets[file][line.to_i] = actual_length - expected_length
|
343
342
|
|
344
343
|
source_file = File.open(file, "w+")
|
345
344
|
source_file.write(source.join(''))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assert_same
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: assert_same assertion
|
15
15
|
email: support@pluron.com
|