rspectacles 0.4.1 → 0.4.2

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: d44e048cdd2464d2a9597d0df39747d69f68267e
4
- data.tar.gz: 2638ad3033b75dc96223c949f8c8bc4ea04c49f9
3
+ metadata.gz: aa7286ee49e8bbd98e4386f61059ce122f6c1a58
4
+ data.tar.gz: c91fad3bc985b8c43da189eeb810a9587bd3c98a
5
5
  SHA512:
6
- metadata.gz: f996de3771c2547e1029bedce76a382ac1c0dee98a6a1ff3c890247866a740372dc75e02f30d75a204b3d1263dfc87c8012647a6e604313e6e56ac93d31e3de6
7
- data.tar.gz: 68f7f7fe1c9f8aa5b4002970241ba33e7e3d5f81c9649bb9d8e9a96b294bc5a55375aa467460be7f448e7cb66cacde4d934e899d6375e5a7eed5e7fd0e56eff0
6
+ metadata.gz: 8510bb32c183c873eb1c84af450690fb859ac2cf1100406b1bbd584191f609bd22a898ec82fc38677bee124c7e4020752857713e1ad10d754a330fc0c47f9456
7
+ data.tar.gz: ac178ca48ba412643baefda727698eac42b099ca677ca3b1b92b38ddffb931ebf4ced7573ffaeb312dead17a9b1b6eefca4ba2d63d8388e9938f79951fd58f28
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ pkg/*
2
2
  .ruby-gemset
3
3
  .ruby-version
4
4
  tmp/*
5
+ .bundle/*
@@ -0,0 +1,58 @@
1
+ AllCops:
2
+ Exclude:
3
+ - db/schema.rb
4
+ - db/migrate/*
5
+
6
+ Documentation:
7
+ Enabled: false
8
+
9
+ LineLength:
10
+ Max: 120
11
+
12
+ MethodLength:
13
+ Max: 15
14
+
15
+ ClassLength:
16
+ Max: 500
17
+
18
+ SpaceBeforeFirstArg:
19
+ Enabled: false
20
+
21
+ AssignmentInCondition:
22
+ Enabled: false
23
+
24
+ SingleLineBlockParams:
25
+ Enabled: false
26
+
27
+ Lambda:
28
+ Enabled: false
29
+
30
+ NumericLiterals:
31
+ Enabled: false
32
+
33
+ LambdaCall:
34
+ Enabled: false
35
+
36
+ AndOr:
37
+ Enabled: false
38
+
39
+ MultilineOperationIndentation:
40
+ Enabled: false
41
+
42
+ AbcSize:
43
+ Max: 20
44
+
45
+ Style/MultilineMethodCallIndentation:
46
+ EnforcedStyle: indented_relative_to_receiver
47
+
48
+ Bundler/OrderedGems:
49
+ Enabled: false
50
+
51
+ Metrics/BlockLength:
52
+ Enabled: false
53
+
54
+ Style/EmptyMethod:
55
+ Enabled: false
56
+
57
+ Style/FrozenStringLiteralComment:
58
+ Enabled: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspectacles (0.4.1)
4
+ rspectacles (0.4.2)
5
5
  httparty
6
6
  pg
7
7
  puma
@@ -12,38 +12,39 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activemodel (5.1.3)
16
- activesupport (= 5.1.3)
17
- activerecord (5.1.3)
18
- activemodel (= 5.1.3)
19
- activesupport (= 5.1.3)
20
- arel (~> 8.0)
21
- activesupport (5.1.3)
15
+ activemodel (5.2.0)
16
+ activesupport (= 5.2.0)
17
+ activerecord (5.2.0)
18
+ activemodel (= 5.2.0)
19
+ activesupport (= 5.2.0)
20
+ arel (>= 9.0)
21
+ activesupport (5.2.0)
22
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
- i18n (~> 0.7)
23
+ i18n (>= 0.7, < 2)
24
24
  minitest (~> 5.1)
25
25
  tzinfo (~> 1.1)
26
- arel (8.0.0)
26
+ arel (9.0.0)
27
27
  coderay (1.1.1)
28
28
  concurrent-ruby (1.0.5)
29
29
  diff-lcs (1.1.3)
30
- httparty (0.15.6)
30
+ httparty (0.16.2)
31
31
  multi_xml (>= 0.5.2)
32
- i18n (0.8.6)
32
+ i18n (1.0.1)
33
+ concurrent-ruby (~> 1.0)
33
34
  method_source (0.8.2)
34
- minitest (5.10.3)
35
+ minitest (5.11.3)
35
36
  multi_xml (0.6.0)
36
- mustermann (1.0.1)
37
- pg (0.21.0)
37
+ mustermann (1.0.2)
38
+ pg (1.0.0)
38
39
  pry (0.10.4)
39
40
  coderay (~> 1.1.0)
40
41
  method_source (~> 0.8.1)
41
42
  slop (~> 3.4)
42
- puma (3.8.2)
43
- rack (2.0.3)
44
- rack-protection (2.0.0)
43
+ puma (3.11.4)
44
+ rack (2.0.4)
45
+ rack-protection (2.0.1)
45
46
  rack
46
- rake (12.0.0)
47
+ rake (12.3.1)
47
48
  rspec (2.12.0)
48
49
  rspec-core (~> 2.12.0)
49
50
  rspec-expectations (~> 2.12.0)
@@ -52,10 +53,10 @@ GEM
52
53
  rspec-expectations (2.12.1)
53
54
  diff-lcs (~> 1.1.3)
54
55
  rspec-mocks (2.12.2)
55
- sinatra (2.0.0)
56
+ sinatra (2.0.1)
56
57
  mustermann (~> 1.0)
57
58
  rack (~> 2.0)
58
- rack-protection (= 2.0.0)
59
+ rack-protection (= 2.0.1)
59
60
  tilt (~> 2.0)
60
61
  sinatra-activerecord (2.0.13)
61
62
  activerecord (>= 3.2)
@@ -63,7 +64,7 @@ GEM
63
64
  slop (3.6.0)
64
65
  thread_safe (0.3.6)
65
66
  tilt (2.0.8)
66
- tzinfo (1.2.3)
67
+ tzinfo (1.2.5)
67
68
  thread_safe (~> 0.1)
68
69
 
69
70
  PLATFORMS
@@ -75,4 +76,4 @@ DEPENDENCIES
75
76
  rspectacles!
76
77
 
77
78
  BUNDLED WITH
78
- 1.14.6
79
+ 1.16.0
data/README.md CHANGED
@@ -40,15 +40,16 @@ sizes by changing the `batch_size` in config settings.
40
40
  ## Storage
41
41
 
42
42
  RSpectacles depends on ActiveRecord for persistence. You
43
- can quickly get an instance up and running by configuring the database.yml file,
43
+ can quickly get an instance up and running by setting the `DATABASE_URL` environment variable,
44
44
  and running the standard rake commands:
45
45
 
46
+ export DATABASE_URL=postgres://...
46
47
  rake db:create
47
48
  rake db:migrate
48
49
 
49
50
  Start the server and connect to it in your browser:
50
51
 
51
- rspectacles
52
+ rackup
52
53
 
53
54
  Then run your specs and watch the magic happen!
54
55
 
@@ -49,7 +49,8 @@ module RSpectacles
49
49
  post '/examples' do
50
50
  payload = JSON.parse(request.body.read)
51
51
 
52
- run = Run.where(rspec_run: payload['examples'].first['rspec_run']).first_or_create
52
+ Run.where(rspec_run: payload['examples'].first['rspec_run']).first_or_create
53
+
53
54
  data = payload['examples'].map do |args|
54
55
  { rspec_run: args['rspec_run'], duration: args['duration'].to_f, properties: args }
55
56
  end
@@ -1,40 +1,62 @@
1
+ // @format
1
2
  /*global define: true d3: true */
2
- define(['jquery', 'pathtree', 'details', 'mustache'], function ($, PathTree, details) {
3
+ define(['jquery', 'pathtree', 'details'], function(
4
+ $,
5
+ PathTree,
6
+ details,
7
+ ) {
3
8
  'use strict';
4
9
 
5
-
6
10
  function chart(options) {
7
- var svg, partition, arc, me
8
- , tmpl = $('#template').html()
9
- , render
10
- ;
11
-
12
- options = $.extend({
13
- width: 960
14
- , height: 700
15
- , color: d3.scale.category20c()
16
- , isCount: false
17
- }, options);
11
+ var svg,
12
+ partition,
13
+ arc,
14
+ me,
15
+ tmpl = $('#template').html(),
16
+ render;
17
+
18
+ options = $.extend(
19
+ {
20
+ width: 960,
21
+ height: 700,
22
+ color: d3.scale.category20c(),
23
+ isCount: false,
24
+ },
25
+ options,
26
+ );
18
27
 
19
28
  options.radius = Math.min(options.width, options.height) / 2;
20
29
 
21
- svg = d3.select("body").append("svg")
22
- .attr("width", options.width)
23
- .attr("height", options.height)
24
- .append("g")
25
- .attr("transform", "translate(" +
26
- options.width / 2 + "," +
27
- options.height * 0.52 + ")");
28
-
29
- partition = d3.layout.partition()
30
- .sort(null)
31
- .size([2 * Math.PI, options.radius * options.radius]);
32
-
33
- arc = d3.svg.arc()
34
- .startAngle(function (d) { return d.x; })
35
- .endAngle(function (d) { return d.x + d.dx; })
36
- .innerRadius(function (d) { return Math.sqrt(d.y); })
37
- .outerRadius(function (d) { return Math.sqrt(d.y + d.dy); });
30
+ svg = d3
31
+ .select('body')
32
+ .append('svg')
33
+ .attr('width', options.width)
34
+ .attr('height', options.height)
35
+ .append('g')
36
+ .attr(
37
+ 'transform',
38
+ 'translate(' + options.width / 2 + ',' + options.height * 0.52 + ')',
39
+ );
40
+
41
+ partition = d3.layout
42
+ .partition()
43
+ .sort(null)
44
+ .size([2 * Math.PI, options.radius * options.radius]);
45
+
46
+ arc = d3.svg
47
+ .arc()
48
+ .startAngle(function(d) {
49
+ return d.x;
50
+ })
51
+ .endAngle(function(d) {
52
+ return d.x + d.dx;
53
+ })
54
+ .innerRadius(function(d) {
55
+ return Math.sqrt(d.y);
56
+ })
57
+ .outerRadius(function(d) {
58
+ return Math.sqrt(d.y + d.dy);
59
+ });
38
60
 
39
61
  // Stash the old values for transition.
40
62
  function stash(d) {
@@ -54,18 +76,23 @@ define(['jquery', 'pathtree', 'details', 'mustache'], function ($, PathTree, det
54
76
  }
55
77
 
56
78
  function secToMin(time) {
57
- var pad = function (val) { return ('00' + val).slice(-2); }
58
- , min = parseInt(time / 60)
59
- , sec = parseInt(time % 60)
60
- ;
79
+ var pad = function(val) {
80
+ return ('00' + val).slice(-2);
81
+ },
82
+ min = parseInt(time / 60),
83
+ sec = parseInt(time % 60);
61
84
 
62
85
  return pad(min) + ':' + pad(sec);
63
86
  }
64
87
 
65
88
  function getValue() {
66
- return options.isCount ?
67
- function () { return 1; } :
68
- function (d) { return d.size; };
89
+ return options.isCount
90
+ ? function() {
91
+ return 1;
92
+ }
93
+ : function(d) {
94
+ return d.size;
95
+ };
69
96
  }
70
97
 
71
98
  function getColor(d) {
@@ -78,19 +105,25 @@ define(['jquery', 'pathtree', 'details', 'mustache'], function ($, PathTree, det
78
105
 
79
106
  function onUpdate(path) {
80
107
  path
81
- .attr("d", arc)
82
- .each(stash)
83
- .style("fill", getColor)
84
- .call(details.update);
108
+ .attr('d', arc)
109
+ .each(stash)
110
+ .style('fill', getColor)
111
+ .call(details.update);
85
112
  }
86
113
 
87
114
  function onEnter(path) {
88
- path.enter().append("path")
89
- .attr("display", function (d) { return d.depth ? null : "none"; })
90
- .attr("d", arc)
91
- .style("stroke", function (d) { return 'rgba(255,255,255,0.3)'; })
92
- .style("fill", getColor)
93
- .style("fill-rule", "evenodd")
115
+ path
116
+ .enter()
117
+ .append('path')
118
+ .attr('display', function(d) {
119
+ return d.depth ? null : 'none';
120
+ })
121
+ .attr('d', arc)
122
+ .style('stroke', function(d) {
123
+ return 'rgba(255,255,255,0.3)';
124
+ })
125
+ .style('fill', getColor)
126
+ .style('fill-rule', 'evenodd')
94
127
  .each(stash)
95
128
  .on('mouseover', details.update)
96
129
  .call(details.update);
@@ -101,47 +134,48 @@ define(['jquery', 'pathtree', 'details', 'mustache'], function ($, PathTree, det
101
134
  }
102
135
 
103
136
  function onFormChange(path) {
104
- d3.selectAll("input").on("change", function change() {
137
+ d3.selectAll('input').on('change', function change() {
105
138
  options.isCount = this.value === 'count';
106
139
 
107
140
  path
108
- .data(partition.value(getValue()).nodes)
141
+ .data(partition.value(getValue()).nodes)
109
142
  .transition()
110
- .duration(1500)
111
- .attrTween("d", arcTween);
143
+ .duration(1500)
144
+ .attrTween('d', arcTween);
112
145
  });
113
146
  }
114
147
 
115
- render = function () {
116
- var path = svg.datum(me.tree.nodes).selectAll("path")
117
- .data(partition.value(getValue()).nodes);
148
+ render = function() {
149
+ var path = svg
150
+ .datum(me.tree.nodes)
151
+ .selectAll('path')
152
+ .data(partition.value(getValue()).nodes);
118
153
 
119
154
  onUpdate(path);
120
155
  onEnter(path);
121
156
  onExit(path);
122
157
  onFormChange(path);
123
158
 
124
- render = function () {
125
- path.datum(me.tree.nodes)
126
- .data(partition.value(getValue()).nodes);
159
+ render = function() {
160
+ path.datum(me.tree.nodes).data(partition.value(getValue()).nodes);
127
161
  };
128
162
  };
129
163
 
130
- return me = {
131
- tree: new PathTree()
164
+ return (me = {
165
+ tree: new PathTree(),
132
166
 
133
- , render: render
167
+ render: render,
134
168
 
135
- , reset: function () {
169
+ reset: function() {
136
170
  me.tree = new PathTree();
137
171
  me.render();
138
- }
172
+ },
139
173
 
140
- , push: function (data) {
174
+ push: function(data) {
141
175
  me.tree.add(data);
142
176
  me.render();
143
- }
144
- };
177
+ },
178
+ });
145
179
  }
146
180
 
147
181
  return chart;
@@ -1,28 +1,28 @@
1
- define(['jquery', 'mustache'], function ($, Mustache) {
2
- var me
3
- , defaults
4
- , current = {}
5
- , tmpl = $('#template').html()
6
- , isCount = false
7
- ;
1
+ define(['jquery', 'mustache'], function($, Mustache) {
2
+ var me,
3
+ defaults,
4
+ current = {},
5
+ tmpl = $('#template').html(),
6
+ isCount = false;
8
7
 
9
- defaults = function () {
8
+ defaults = function() {
10
9
  return {
11
- name: ''
12
- , line_number: ''
13
- , status: ''
14
- , duration: ''
15
- , time_or_count: isCount ? 'Examples' : 'ms'
16
- , minutes: ''
17
- , value: null
10
+ name: '',
11
+ line_number: '',
12
+ status: '',
13
+ duration: '',
14
+ time_or_count: isCount ? 'Examples' : 'ms',
15
+ minutes: '',
16
+ value: null
18
17
  };
19
18
  };
20
19
 
21
20
  function secToMin(time) {
22
- var pad = function (val) { return ('00' + val).slice(-2); }
23
- , min = parseInt(time / 60)
24
- , sec = parseInt(time % 60)
25
- ;
21
+ var pad = function(val) {
22
+ return ('00' + val).slice(-2);
23
+ },
24
+ min = parseInt(time / 60),
25
+ sec = parseInt(time % 60);
26
26
 
27
27
  return pad(min) + ':' + pad(sec);
28
28
  }
@@ -39,13 +39,13 @@ define(['jquery', 'mustache'], function ($, Mustache) {
39
39
  }
40
40
 
41
41
  return {
42
- update: function (d) {
42
+ update: function(d) {
43
43
  current = $.extend({}, defaults(), d);
44
44
  render();
45
- }
45
+ },
46
46
 
47
- , isCount: function (value) {
47
+ isCount: function(value) {
48
48
  isCount = value;
49
- }
49
+ },
50
50
  };
51
51
  });
@@ -1,29 +1,32 @@
1
+ // @format
1
2
  /*global define: true */
2
- define(['jquery'], function ($) {
3
+ define(['jquery'], function($) {
3
4
  'use strict';
4
5
 
5
6
  function createNodes(path, data, node) {
6
- var nextNode
7
- ;
7
+ var nextNode;
8
8
 
9
9
  node.children = node.children || [];
10
10
 
11
11
  if (path.length === 0) {
12
- nextNode = $.extend({
13
- size: data.duration
14
- , name: data.full_description
15
- }, data);
12
+ nextNode = $.extend(
13
+ {
14
+ size: data.duration,
15
+ name: data.full_description,
16
+ },
17
+ data,
18
+ );
16
19
 
17
20
  node.children.push(nextNode);
18
21
  return;
19
22
  }
20
23
 
21
- nextNode = node.children.filter(function (child) {
24
+ nextNode = node.children.filter(function(child) {
22
25
  return child.name === path[0];
23
26
  })[0];
24
27
 
25
28
  if (!nextNode) {
26
- nextNode = { name: path[0] };
29
+ nextNode = {name: path[0]};
27
30
  node.children.push(nextNode);
28
31
  }
29
32
 
@@ -36,15 +39,17 @@ define(['jquery'], function ($) {
36
39
  data && this.add(data);
37
40
  }
38
41
 
39
- PathTree.prototype.add = function (data) {
42
+ PathTree.prototype.add = function(data) {
40
43
  var that = this;
41
44
  !$.isArray(data) && (data = [data]);
42
45
 
43
- data.forEach(function (node) {
46
+ data.forEach(function(node) {
44
47
  var path = node.file_path.split('/');
45
48
 
46
- ['.'].forEach(function (v) {
47
- if (path[0] === v) { path.shift(); }
49
+ ['.'].forEach(function(v) {
50
+ if (path[0] === v) {
51
+ path.shift();
52
+ }
48
53
  });
49
54
 
50
55
  createNodes(path, node, that.nodes);
@@ -6,7 +6,7 @@ require 'securerandom'
6
6
  module RSpectacles
7
7
  class Config
8
8
  def initialize
9
- @opts = OpenStruct.new defaults.merge(yml.symbolize_keys)
9
+ @opts = OpenStruct.new defaults.merge(yml)
10
10
  end
11
11
 
12
12
  def defaults
@@ -18,8 +18,12 @@ module RSpectacles
18
18
  }
19
19
  end
20
20
 
21
+ def timeout
22
+ @opts[:timeout]
23
+ end
24
+
21
25
  def method_missing(method, *args)
22
- @opts.send method, *args
26
+ @opts.public_send method, *args
23
27
  end
24
28
 
25
29
  private
@@ -33,11 +37,17 @@ module RSpectacles
33
37
  end
34
38
 
35
39
  def yml
36
- if yml_exists?
37
- @yml ||= ::YAML.load(::ERB.new(IO.read(yml_path)).result)
38
- else
39
- {}
40
- end
40
+ res = if yml_exists?
41
+ @yml ||= ::YAML.safe_load(::ERB.new(IO.read(yml_path)).result)
42
+ else
43
+ {}
44
+ end
45
+
46
+ sanitize(res)
47
+ end
48
+
49
+ def sanitize(hash)
50
+ hash.each_with_object({}) { |(key, value), memo| memo[key.to_sym] = value }
41
51
  end
42
52
  end
43
53
 
@@ -4,11 +4,11 @@ module RSpectacles
4
4
  module Formatter
5
5
  class Base
6
6
  RSpec::Core::Formatters.register self,
7
- *%i(example_passed
8
- example_failed
9
- start
10
- stop
11
- message)
7
+ :example_passed,
8
+ :example_failed,
9
+ :start,
10
+ :stop,
11
+ :message
12
12
 
13
13
  attr_reader :output
14
14
 
@@ -19,7 +19,7 @@ module RSpectacles
19
19
  @logger ||= RSpectacles::Adapter::Logger.new(test_run_key: current_run_key)
20
20
  end
21
21
 
22
- def message(notification)
22
+ def message(_notification)
23
23
  end
24
24
 
25
25
  def start(_)
@@ -1,3 +1,3 @@
1
1
  module RSpectacles
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = RSpectacles::VERSION
8
8
  s.authors = ['Michael Wheeler']
9
9
  s.email = ['mwheeler@g2crowd.com']
10
- s.homepage = 'https://github.com/G2Labs-net/rspectacles'
10
+ s.homepage = 'https://github.com/g2crowd/rspectacles'
11
11
  s.summary = %q{Visualize rspec test running in the browser}
12
12
  s.description = %q{Visualize rspec test running in the browser}
13
13
  s.license = 'MIT'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspectacles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wheeler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -132,6 +132,7 @@ extra_rdoc_files: []
132
132
  files:
133
133
  - ".gitignore"
134
134
  - ".jshintrc"
135
+ - ".rubocop.yml"
135
136
  - Gemfile
136
137
  - Gemfile.lock
137
138
  - LICENSE
@@ -180,7 +181,7 @@ files:
180
181
  - spec/javascripts/test.html
181
182
  - spec/javascripts/tests/pathtree_spec.js
182
183
  - viz.png
183
- homepage: https://github.com/G2Labs-net/rspectacles
184
+ homepage: https://github.com/g2crowd/rspectacles
184
185
  licenses:
185
186
  - MIT
186
187
  metadata: {}