x-ray-machine 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2cb28a8842d3f822f65d69b126f828ce8c16834
|
4
|
+
data.tar.gz: 42e33d133c8889bb5ae553fd9a520cf552b88667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2a56a92ce8af8158a021bbae496a18f06f5956a7ddf65aa771c5028c201095e03a6d7ed872cd9424b31ddcfc6deeee4198eee967ac99c7a34a3dfe849337335
|
7
|
+
data.tar.gz: 42e8a5497fe9bf37278193c859a6cb4d93612f179cce3413a5b8c1e4537b7ca2bff6963d665043907353d50a4de530e45eecd7fb79b64f0e3de82d6a3d112b1b
|
data/lib/x_ray_machine/config.rb
CHANGED
@@ -27,20 +27,17 @@ module XRayMachine
|
|
27
27
|
name = name.to_sym
|
28
28
|
|
29
29
|
if config
|
30
|
-
@streams[name] = fill_defaults_for(config)
|
30
|
+
@streams[name] = fill_defaults_for(name, config)
|
31
31
|
else
|
32
|
-
@streams[name] ||=
|
32
|
+
@streams[name] ||= fill_defaults_for(name)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
def
|
39
|
-
fill_defaults_for title: name.to_s.gsub(/(^|_)([a-z])/) { |m| $2.upcase }
|
40
|
-
end
|
41
|
-
|
42
|
-
def fill_defaults_for(config)
|
38
|
+
def fill_defaults_for(name, config={})
|
43
39
|
{
|
40
|
+
title: name.to_s.gsub(/(^|_)([a-z])/) { |m| $2.upcase },
|
44
41
|
color: available_colors[0],
|
45
42
|
show_in_summary: true
|
46
43
|
}.merge config
|
@@ -50,6 +50,12 @@ describe XRayMachine::Config do
|
|
50
50
|
expect(colors).to eq ["\e[31m", "\e[32m", "\e[33m"]
|
51
51
|
end
|
52
52
|
|
53
|
+
it "works great when only a color was configured" do
|
54
|
+
XRayMachine.config { |c| c.some_thing = {color: :yellow} }
|
55
|
+
|
56
|
+
is_expected.to eq({title: "SomeThing", color: "\e[33m", show_in_summary: true})
|
57
|
+
end
|
58
|
+
|
53
59
|
end
|
54
60
|
|
55
61
|
end
|
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe XRayMachine::LogSubscriber do
|
4
4
|
before { XRayMachine::LogSubscriber.reset_runtimes }
|
5
|
+
before { XRayMachine.instance_eval{ @options = nil } }
|
5
6
|
|
6
7
|
describe ".runtimes" do
|
7
8
|
subject { XRayMachine::LogSubscriber.runtimes }
|
@@ -35,14 +36,14 @@ describe XRayMachine::LogSubscriber do
|
|
35
36
|
|
36
37
|
it "dumps the data in the debugging stream" do
|
37
38
|
expect{ subject }.to change{ subscriber.debug }
|
38
|
-
.to(" \e[1m\e[
|
39
|
+
.to(" \e[1m\e[31mExternalApi (11.0ms)\e[0m some/query/data")
|
39
40
|
end
|
40
41
|
|
41
42
|
it "marks things cached when the payload have a cache:true option" do
|
42
43
|
payload[:cache] = true
|
43
44
|
|
44
45
|
expect{ subject }.to change{ subscriber.debug }
|
45
|
-
.to(" \e[1m\e[
|
46
|
+
.to(" \e[1m\e[31mExternalApi CACHE (11.0ms)\e[0m some/query/data")
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|