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: 0a96ac18783ffbb5d0c77256f0cdb11e3cf7c2ce
4
- data.tar.gz: a8b664e63e6450c3f0cb3012c397a9d65af50802
3
+ metadata.gz: a2cb28a8842d3f822f65d69b126f828ce8c16834
4
+ data.tar.gz: 42e33d133c8889bb5ae553fd9a520cf552b88667
5
5
  SHA512:
6
- metadata.gz: 3dec83fd88b356ae3fe723dd451537fdd483d2555dd3f63d888af90e476bd6adaa1c4c4aa1d25e5da3490313a4c1c53bafa6369756b5d6ec2d1731d5fd9522a5
7
- data.tar.gz: 4542b55289dcaa18d99aadca5f3ba18475b0bc8a663ede503bb02baa2d4297dc093bf2134f66fdf656775a80851aa010897749c0bfda6f7b1bdea33a8aa03799
6
+ metadata.gz: a2a56a92ce8af8158a021bbae496a18f06f5956a7ddf65aa771c5028c201095e03a6d7ed872cd9424b31ddcfc6deeee4198eee967ac99c7a34a3dfe849337335
7
+ data.tar.gz: 42e8a5497fe9bf37278193c859a6cb4d93612f179cce3413a5b8c1e4537b7ca2bff6963d665043907353d50a4de530e45eecd7fb79b64f0e3de82d6a3d112b1b
@@ -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] ||= generate_options_for(name)
32
+ @streams[name] ||= fill_defaults_for(name)
33
33
  end
34
34
  end
35
35
 
36
36
  private
37
37
 
38
- def generate_options_for(name)
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
@@ -1,3 +1,3 @@
1
1
  module XRayMachine
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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[34mExternalApi (11.0ms)\e[0m some/query/data")
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[34mExternalApi CACHE (11.0ms)\e[0m some/query/data")
46
+ .to(" \e[1m\e[31mExternalApi CACHE (11.0ms)\e[0m some/query/data")
46
47
  end
47
48
  end
48
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: x-ray-machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikolay Nemshilov