rspectacles 0.0.7 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55a26564ce13d66c487172e032524359c5440e6d
4
- data.tar.gz: cb85f1910af0e08b2cc4ad8bead4cdc671057b89
3
+ metadata.gz: fb44a5d138ccbea60ba08f93cf8de9ad214fd328
4
+ data.tar.gz: 8ce8e87c8e6b3b97bd38b23c930bc1416a31f37e
5
5
  SHA512:
6
- metadata.gz: bf43b503e80ca48f4babc6e9830ffcfe305bb96b9f8e7273c4b04e97a33c0d28218fc2a4f6ed01cfce6a9e843940915ce166a5f09a73c26dea0bd11cd8c18a70
7
- data.tar.gz: 1e43d2e4f4307a0d61daeaf2ad1412563abf543aa87f8e906677fb248a5e7698b874346f2d55c24396b9d7c3de4dab579243ee5e1ba94d927b647fbac09ef7fe
6
+ metadata.gz: a7dfe8b33a4480590058e2628782771bc2fa9689690160aba0a74f499828ca1391a2dc303e8b2ba691c0d2677908957fde43bb556cf3d6ff1406444cf1166ad0
7
+ data.tar.gz: 056848ea860871e4bc9c4c5aaca0ab5523293d3dbda50516b13542b56b47f64ca13f84f9d88367812a928f1bd27f8274d6caab64c5273d1e82b8f083028e4eec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspectacles (0.0.7)
4
+ rspectacles (0.0.8)
5
5
  em-hiredis (~> 0.2.1)
6
6
  rake
7
7
  redis
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/rspectacles.png)](http://badge.fury.io/rb/rspectacles)
1
2
  # RSpectacles
2
3
 
3
4
  RSpectacles is an in-browser visualizer and profiler for RSpec. It uses
@@ -6,6 +6,7 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
6
6
  function chart(options) {
7
7
  var svg, partition, arc, me
8
8
  , tmpl = $('#template').html()
9
+ , render
9
10
  ;
10
11
 
11
12
  options = $.extend({
@@ -52,21 +53,26 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
52
53
  };
53
54
  }
54
55
 
55
- function showDetails(data) {
56
- var mappedData = $.extend({
57
- name: ''
58
- , line_number: ''
59
- , status: ''
60
- , duration: ''
61
- , time_or_count: options.isCount ? 'Examples' : 'Seconds'
62
- }, data)
63
- , map
56
+ function showDetails() {
57
+ var data = showDetails.current
58
+ , mappedData = $.extend({
59
+ name: ''
60
+ , line_number: ''
61
+ , status: ''
62
+ , duration: ''
63
+ , time_or_count: options.isCount ? 'Examples' : 'Seconds'
64
+ , value: null
65
+ }, data)
66
+ , map
64
67
  ;
65
68
 
66
- !options.isCount && (mappedData.value = mappedData.value.toFixed(3));
69
+ if (mappedData.value) {
70
+ !options.isCount && (mappedData.value = mappedData.value.toFixed(3));
71
+ }
67
72
 
68
73
  $('.example-wrapper').html(Mustache.render(tmpl, mappedData));
69
74
  }
75
+ showDetails.current = {};
70
76
 
71
77
  function getValue() {
72
78
  return options.isCount ?
@@ -82,26 +88,34 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
82
88
  }
83
89
  }
84
90
 
85
- function render() {
86
- var path = svg.datum(me.tree.nodes).selectAll("path")
87
- .data(partition.value(getValue()).nodes);
88
-
91
+ function onUpdate(path) {
89
92
  path
90
93
  .attr("d", arc)
91
94
  .each(stash)
92
- .style("fill", getColor);
95
+ .style("fill", getColor)
96
+ .call(showDetails);
97
+ }
93
98
 
99
+ function onEnter(path) {
94
100
  path.enter().append("path")
95
- .attr("display", function (d) { return d.depth ? null : "none"; })
96
- .attr("d", arc)
97
- .style("stroke", function (d) { return 'rgba(255,255,255,0.3)'; })
98
- .style("fill", getColor)
99
- .style("fill-rule", "evenodd")
100
- .each(stash)
101
- .on('mouseover', showDetails);
101
+ .attr("display", function (d) { return d.depth ? null : "none"; })
102
+ .attr("d", arc)
103
+ .style("stroke", function (d) { return 'rgba(255,255,255,0.3)'; })
104
+ .style("fill", getColor)
105
+ .style("fill-rule", "evenodd")
106
+ .each(stash)
107
+ .on('mouseover', function (d) {
108
+ showDetails.current = d;
109
+ showDetails();
110
+ })
111
+ .call(showDetails);
112
+ }
102
113
 
114
+ function onExit(path) {
103
115
  path.exit().remove();
116
+ }
104
117
 
118
+ function onFormChange(path) {
105
119
  d3.selectAll("input").on("change", function change() {
106
120
  options.isCount = this.value === 'count';
107
121
 
@@ -113,6 +127,21 @@ define(['jquery', 'pathtree', 'mustache'], function ($, PathTree, Mustache) {
113
127
  });
114
128
  }
115
129
 
130
+ render = function () {
131
+ var path = svg.datum(me.tree.nodes).selectAll("path")
132
+ .data(partition.value(getValue()).nodes);
133
+
134
+ onUpdate(path);
135
+ onEnter(path);
136
+ onExit(path);
137
+ onFormChange(path);
138
+
139
+ render = function () {
140
+ path.datum(me.tree.nodes)
141
+ .data(partition.value(getValue()).nodes);
142
+ };
143
+ };
144
+
116
145
  return me = {
117
146
  tree: new PathTree()
118
147
 
@@ -2,6 +2,7 @@ require 'rspec/core/formatters/base_formatter'
2
2
  require 'rspectacles/config'
3
3
  require 'ostruct'
4
4
  require 'redis'
5
+ require 'uri'
5
6
 
6
7
  module RSpectacles
7
8
  class RedisFormatter < RSpec::Core::Formatters::BaseFormatter
@@ -14,7 +15,7 @@ module RSpectacles
14
15
  end
15
16
 
16
17
  def initialize(output)
17
- uri = config.redis_uri
18
+ uri = URI.parse config.redis_uri
18
19
  self.redis = Redis.new host: uri.host, port: uri.port, password: uri.password
19
20
  end
20
21
 
@@ -1,3 +1,3 @@
1
1
  module RSpectacles
2
- VERSION='0.0.7'
2
+ VERSION='0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspectacles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wheeler