vignette 0.0.4pre1 → 0.0.4pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vignette/object_extensions.rb +7 -3
- data/lib/vignette/version.rb +1 -1
- metadata +1 -1
@@ -3,9 +3,13 @@ module ObjectExtensions
|
|
3
3
|
# Extensions to the Array object
|
4
4
|
module ArrayExtensions
|
5
5
|
|
6
|
+
def crc
|
7
|
+
Zlib.crc32(self.join)
|
8
|
+
end
|
9
|
+
|
6
10
|
# Test will select a random object from the Array
|
7
11
|
def vignette(name=nil)
|
8
|
-
key = "vignette_#{name ||
|
12
|
+
key = "vignette_#{name || crc.abs.to_s(16)}"
|
9
13
|
test_name = nil
|
10
14
|
|
11
15
|
if name.blank?
|
@@ -13,7 +17,7 @@ module ObjectExtensions
|
|
13
17
|
# E.g /Users/hayesgm/animals/shadow/app/views/landing/family.html.haml:11:in `_app_views_landing_family_html_haml__3008026497873467685_70232967999960'
|
14
18
|
# -> app/views/landing/family.html.haml:313c7f3a472883ba
|
15
19
|
filename = caller[1].split(':')[0].gsub(Rails.root.to_s+'/','') # Take the view name
|
16
|
-
test_name = "#{filename}:#{
|
20
|
+
test_name = "#{filename}:#{crc.abs.to_s(16)}"
|
17
21
|
else
|
18
22
|
# E.g /Users/hayesgm/animals/shadow/app/controllers/home_controller.rb:27:in `home'
|
19
23
|
# -> app/controllers/home_controller:home:313c7f3a472883ba
|
@@ -22,7 +26,7 @@ module ObjectExtensions
|
|
22
26
|
m = /(?<filename>[\w.\/]+):(?<line>\d+):in `(?<function>\w+)'/.match(line)
|
23
27
|
|
24
28
|
if m && !m[:filename].blank? && !m[:function].blank?
|
25
|
-
test_name = "#{m[:filename]}:#{m[:function]}:#{
|
29
|
+
test_name = "#{m[:filename]}:#{m[:function]}:#{crc.abs.to_s(16)}"
|
26
30
|
else # Fallback
|
27
31
|
test_name = key
|
28
32
|
end
|
data/lib/vignette/version.rb
CHANGED