chartspec 0.0.8 → 0.0.9

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: dfff92c7d2ad18db04d89b49e5245d3fb09412b6
4
- data.tar.gz: 37ae98e4409eefb080bf0abd42d7fba35627adfb
3
+ metadata.gz: 51bbe1d651578bf7a8a0a51395a482a3a577b96a
4
+ data.tar.gz: 34a81424c5ceb0b9d376281970eacb948d999135
5
5
  SHA512:
6
- metadata.gz: 926669f72502f5e091187cf7e5401866924aa93df0960197adf8c844121e97077ccba8ff297c8bf0443880d136bd19e9973312dbdb90ccf59c8a08cfaa5e6235
7
- data.tar.gz: ee0767b05e9dee4f23aa34fa0fb21e778ef0381aafb56d604ab31329aa59b16f2e73b23c237f3e36e0c982ebce82c01eec460e21091fedc35e396d4e12b3c16f
6
+ metadata.gz: a7cf440a50176d7242478ba04a4cf87f5ec93a5dca8217c377098a365efed742a9235b218e4780ca4ad8e8cb509105319da1dbd9de18598f29c6227fb8d64a61
7
+ data.tar.gz: fb77b4cfd82b2f5bdffc5867287d41f570bf4b1bb4eece2199ac72d6bffd1cc2a0fade1da293365face0d2125888adb89af008c94eb20d3a3069b403bd1dd40b
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  mkmf.log
15
15
  .project
16
16
  pkg
17
+ Gemfile.lock
@@ -7,7 +7,7 @@ require 'json'
7
7
 
8
8
  module Chartspec
9
9
  class Formatter < RSpec::Core::Formatters::BaseTextFormatter
10
- RSpec::Core::Formatters.register self, :start, :example_group_started, :start_dump, :example_started, :example_passed, :example_failed, :example_pending, :dump_failures, :dump_pending
10
+ RSpec::Core::Formatters.register self, :start, :example_group_started, :start_dump, :example_started, :example_passed, :example_failed, :example_pending, :dump_failures, :dump_pending, :message
11
11
 
12
12
  def initialize(output)
13
13
  super output
@@ -58,7 +58,7 @@ module Chartspec
58
58
 
59
59
  def example_passed(passed)
60
60
  putc RSpec::Core::Formatters::ConsoleCodes.wrap('.', :success)
61
- @printer.print_example_passed(passed.example.description, passed.example.execution_result.run_time, passed.example.metadata[:chartspec_turnip])
61
+ @printer.print_example_passed(passed.example.description, passed.example.execution_result.run_time, passed.example.metadata[:chartspec_turnip], video_path(passed.example))
62
62
  @db.add(
63
63
  passed.example.metadata[:file_path],
64
64
  passed.example.example_group,
@@ -74,7 +74,7 @@ module Chartspec
74
74
  @header_red = true
75
75
  end
76
76
  @printer.print_example_failed(@example_number, failure.example.metadata[:file_path], failure.example.description, failure.example.execution_result.run_time,
77
- failure.example.exception.message, failure.example.exception.backtrace, failure.example.metadata[:chartspec_turnip])
77
+ failure.example.exception.message, failure.example.exception.backtrace, failure.example.metadata[:chartspec_turnip], video_path(passed.example))
78
78
  end
79
79
 
80
80
  def example_pending(pending)
@@ -92,6 +92,10 @@ module Chartspec
92
92
  puts notification.fully_formatted_pending_examples
93
93
  end
94
94
 
95
+ def message(notification = nil)
96
+ puts notification.message
97
+ end
98
+
95
99
  private
96
100
  def example_group_number
97
101
  @example_group_number
@@ -122,5 +126,9 @@ module Chartspec
122
126
  end
123
127
  @printer.print_chart_script(example_file, example_group, chart_data) unless chart_data.empty?
124
128
  end
129
+
130
+ def video_path(example)
131
+ return File.basename(example.metadata[:video_path])
132
+ end
125
133
  end
126
134
  end
@@ -10,6 +10,7 @@ module Chartspec
10
10
  end
11
11
 
12
12
  def print_html_start
13
+ @title = ENV['CHARTSPEC_TITLE'] || 'Chartspec'
13
14
  chartspec_header = ERB.new File.new(File.expand_path("../../../templates/chartspec.html.erb", __FILE__)).read
14
15
  @output.puts chartspec_header.result(binding)
15
16
  end
@@ -27,7 +28,7 @@ module Chartspec
27
28
  parents_count.times do
28
29
  @output.puts "<span class='media-left'>&nbsp;</span>"
29
30
  end
30
- @output.puts "<div class='media-body' style='width:100%;'><h4 class='media-heading'>#{title}</h4>"
31
+ @output.puts "<div class='media-body' style='width:100%;padding-bottom: 15px;'><h4 class='media-heading'>#{title}</h4>"
31
32
  @output.puts "<div class='thumbnail hide'><div id='chart_#{group_id}' data-chart='#{chart}' style='height:100px; width:100%;'></div></div>"
32
33
  end
33
34
 
@@ -35,9 +36,12 @@ module Chartspec
35
36
  @output.puts "</div></li></ul>"
36
37
  end
37
38
 
38
- def print_example_passed(description, run_time, turnip = nil)
39
+ def print_example_passed(description, run_time, turnip = nil, video_path = nil)
39
40
  formatted_run_time = "%.5f" % run_time
40
41
  @output.puts "<div><div class='pull-right'>#{formatted_run_time}s</div><div class='text-success' style='border-bottom: 1px dotted #cccccc;'>&check; <b class='text-success'>"
42
+ if (video_path)
43
+ @output.puts " <button onclick=\"set_video('#{video_path}', '#{h(description)}'); $('#video').show().addClass('in')\" type='button' class='btn btn-warning btn-xs'>&#9658;</button>"
44
+ end
41
45
  if turnip
42
46
  @output.puts "<table class='table table-condensed'>"
43
47
  turnip[:steps].each do |step|
@@ -50,9 +54,12 @@ module Chartspec
50
54
  @output.puts "</b></div></div>"
51
55
  end
52
56
 
53
- def print_example_failed(example_id, filepath, description, run_time, error, backtrace, turnip = nil)
57
+ def print_example_failed(example_id, filepath, description, run_time, error, backtrace, turnip = nil, video_file = nil)
54
58
  formatted_run_time = "%.5f" % run_time
55
59
  @output.puts "<div><div class='pull-right'>#{formatted_run_time}s</div><div class='bg-danger' style='border-bottom: 1px dotted #cccccc;'>&nbsp;!&nbsp; <b class='text-danger'>"
60
+ if (video_path)
61
+ @output.puts " <button onclick=\"set_video('#{video_path}', '#{h(description)}'); $('#video').show().addClass('in')\" type='button' class='btn btn-warning btn-xs'>&#9658;</button>"
62
+ end
56
63
  if turnip
57
64
  line = backtrace.find do |bt|
58
65
  bt.match(/#{filepath}:(\d+)/)
@@ -1,3 +1,3 @@
1
1
  module Chartspec
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <title>Chartspec</title>
7
+ <title><%= @title %></title>
8
8
 
9
9
  <!-- Bootstrap -->
10
10
  <style>
@@ -27,7 +27,13 @@
27
27
  <%= File.open(File.join(@assets_path,"javascripts/jqplot/jquery.jqplot.min.js")).read %>
28
28
  <%= File.open(File.join(@assets_path,"javascripts/jqplot/jqplot.dateAxisRenderer.min.js")).read %>
29
29
  <%= File.open(File.join(@assets_path,"javascripts/jqplot/jqplot.highlighter.min.js")).read %>
30
-
30
+ function set_video(src, title) {
31
+ var player = document.getElementsByTagName('video')[0];
32
+ var sources = video.getElementsByTagName('source');
33
+ sources[0].src = src;
34
+ player.load();
35
+ $("#video .modal-title").html(title);
36
+ }
31
37
  function draw_chart(chart_id, data, keys) {
32
38
  var chart_container = $("[data-chart='"+chart_id+"']");
33
39
  chart_container.parent().removeClass('hide');
@@ -81,14 +87,30 @@
81
87
  <span class="icon-bar"></span>
82
88
  <span class="icon-bar"></span>
83
89
  </button>
84
- <a class="navbar-brand" href="#">Chartspec</a>
90
+ <a class="navbar-brand" href="#"><%= @title %></a>
85
91
  </div>
86
92
  <div id="navbar" class="collapse navbar-collapse">
87
93
  <ul class="nav navbar-nav">
88
- <li class="active"><a href="#">Examples</a></li>
94
+ <li class="active"><a href="#">Tests</a></li>
89
95
  <!-- <li><a href="#about">Statistics</a></li> -->
90
96
  </ul>
91
97
  </div><!--/.nav-collapse -->
92
98
  </div>
93
99
  </nav>
100
+ <div id="video" class="modal fade">
101
+ <div class="modal-dialog modal-lg">
102
+ <div class="modal-content">
103
+ <div class="modal-header">
104
+ <button onclick="set_video('');$('#video').hide().removeClass('in')" type="button" class="btn btn-default btn-sm pull-right" data-dismiss="modal" aria-label="Close">X</button>
105
+ <h4 class="modal-title">Video</h4>
106
+ </div>
107
+ <div class="modal-body">
108
+ <video width="100%" controls>
109
+ <source src="" type="video/mp4">
110
+ Your browser does not support HTML5 video.
111
+ </video>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </div>
94
116
  <div class='container'>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chartspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlexVangelov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-28 00:00:00.000000000 Z
11
+ date: 2015-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.2.2
124
+ rubygems_version: 2.4.6
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: RSpec with execution time history charts