rspec-web 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-web (0.1.1)
4
+ rspec-web (0.1.5)
5
5
  em-websocket (~> 0.3.6)
6
6
  haml (~> 3.1.4)
7
7
  rspec (~> 2.8.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
data/bin/rspec-web CHANGED
@@ -1,4 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ lib = Pathname.new(__FILE__).dirname.join('..', 'lib').expand_path.to_s
5
+ $:.unshift(lib) unless $:.include?(lib)
2
6
  require 'rspec_web'
3
7
 
4
8
  RspecWeb::WebSocketServer.run!
@@ -13,7 +13,6 @@ module RspecWeb
13
13
  puts "View at http://0.0.0.0:4567"
14
14
 
15
15
  @timestamp = Time.now.to_i
16
-
17
16
  @socket = WebSocket.new("ws://localhost:10081")
18
17
 
19
18
  message = { receiver: "server", method: "identify", arguments: ["rspec"] }
@@ -24,113 +23,74 @@ module RspecWeb
24
23
  end
25
24
 
26
25
  def example_group_started(example_group)
27
- # puts "#{__method__} -----------------------"
26
+
28
27
  end
29
28
 
30
29
  def example_group_finished(example_group)
31
- # puts "#{__method__} -----------------------"
32
- # # puts "example_group => #{example_group.inspect}"
30
+
33
31
  end
34
32
 
35
33
  def example_started(example)
36
- # puts "#{__method__} -----------------------"
37
- # # puts "example => #{example.inspect}"
34
+
38
35
  end
39
36
 
40
37
  def example_passed(example)
41
- # puts "#{__method__} -----------------------"
42
-
43
- data = {
44
- :started_at => example.metadata[:execution_result][:started_at].to_i,
45
- :finished_at => example.metadata[:execution_result][:started_at].to_i,
46
- :run_time => example.metadata[:execution_result][:run_time],
47
- :file_path => example.metadata[:file_path],
48
- :line_number => example.metadata[:line_number],
49
- :description => example.metadata[:full_description]
50
- }
51
-
38
+ data = example_to_hash(example)
52
39
  message = { receiver: "web", method: "addToPassing", arguments: [@timestamp, data] }
53
40
  @socket.send(message.to_json)
54
41
  end
55
42
 
56
43
  def example_pending(example)
57
- # puts "#{__method__} -----------------------"
58
-
59
- data = {
60
- :started_at => example.metadata[:execution_result][:started_at].to_i,
61
- :finished_at => example.metadata[:execution_result][:started_at].to_i,
62
- :run_time => example.metadata[:execution_result][:run_time],
63
- :file_path => example.metadata[:file_path],
64
- :line_number => example.metadata[:line_number],
65
- :description => example.metadata[:full_description]
66
- }
67
-
44
+ data = example_to_hash(example)
68
45
  message = { receiver: "web", method: "addToPending", arguments: [@timestamp, data] }
69
46
  @socket.send(message.to_json)
70
47
  end
71
48
 
72
49
  def example_failed(example)
73
- # puts "#{__method__} -----------------------"
74
-
75
- data = {
76
- :started_at => example.metadata[:execution_result][:started_at].to_i,
77
- :finished_at => example.metadata[:execution_result][:started_at].to_i,
78
- :run_time => example.metadata[:execution_result][:run_time],
79
- :file_path => example.metadata[:file_path],
80
- :line_number => example.metadata[:line_number],
81
- :description => example.metadata[:full_description]
82
- }
83
-
50
+ data = example_to_hash(example)
84
51
  message = { receiver: "web", method: "addToFailing", arguments: [@timestamp, data] }
85
52
  @socket.send(message.to_json)
86
53
  end
87
54
 
88
55
  def start_dump
89
- # puts "#{__method__} -----------------------"
90
56
  end
91
57
 
92
58
  def dump_failed(example)
93
- # puts "#{__method__} -----------------------"
94
- # puts "example => #{example.inspect}"
95
59
  end
96
60
 
97
61
  def dump_summary(duration, example_count, failure_count, pending_count)
98
- # puts "#{__method__} -----------------------"
99
- # puts "duration => #{duration.inspect}"
100
- # puts "example_count => #{example_count.inspect}"
101
- # puts "failure_count => #{failure_count.inspect}"
102
- # puts "pending_count => #{pending_count.inspect}"
103
62
  end
104
63
 
105
64
  def message(message)
106
- # puts "#{__method__} -----------------------"
107
- # puts "message => #{message.inspect}"
108
65
  end
109
66
 
110
67
  def dump_failures
111
- # puts "#{__method__} -----------------------"
112
68
  end
113
69
 
114
70
  def dump_pending
115
- # puts "#{__method__} -----------------------"
116
71
  end
117
72
 
118
73
  def format_backtrace(backtrace, example)
119
- # puts "#{__method__} -----------------------"
120
- # puts "backtrace => #{backtrace.inspect}"
121
- # # puts "example => #{example.inspect}"
122
74
  end
123
75
 
124
76
  def close
125
- # puts "#{__method__} -----------------------"
126
-
127
77
  puts "Specs finished!.. "
128
-
129
78
  message = { receiver: "server", method: "disconnect", arguments: ["rspec"] }
130
-
131
79
  @socket.send(message.to_json)
132
-
133
80
  @socket.close
134
81
  end
82
+
83
+ private
84
+
85
+ def example_to_hash(example)
86
+ {
87
+ :started_at => example.metadata[:execution_result][:started_at].to_i,
88
+ :finished_at => example.metadata[:execution_result][:finished_at].to_i,
89
+ :run_time => example.metadata[:execution_result][:run_time],
90
+ :file_path => example.metadata[:file_path],
91
+ :line_number => example.metadata[:line_number],
92
+ :description => example.metadata[:full_description]
93
+ }
94
+ end
135
95
  end
136
96
  end
@@ -18,6 +18,7 @@ function Iteration(timestamp, exampleCount, iterationEntry) {
18
18
  $('#iteration-'+timestamp+'-tab-passing-count').html(self.passingExamples.length);
19
19
  self.updateProgressBar();
20
20
  self.updateListEntryIcon();
21
+ $('#finishedExampleCount').html( self.finishedExampleCount() );
21
22
  },
22
23
  addToPending : function(data){
23
24
  $.extend(data, { timestamp: timestamp, exampleIndex: self.finishedExampleCount()-1 });
@@ -27,6 +28,7 @@ function Iteration(timestamp, exampleCount, iterationEntry) {
27
28
  $('#iteration-'+timestamp+'-tab-pending-count').html(self.pendingExamples.length);
28
29
  self.updateProgressBar();
29
30
  self.updateListEntryIcon();
31
+ $('#finishedExampleCount').html( self.finishedExampleCount() );
30
32
  },
31
33
  addToFailing : function(data){
32
34
  $.extend(data, { timestamp: timestamp, exampleIndex: self.finishedExampleCount()-1 });
@@ -36,11 +38,12 @@ function Iteration(timestamp, exampleCount, iterationEntry) {
36
38
  $('#iteration-'+timestamp+'-tab-failing-count').html(self.failingExamples.length);
37
39
  self.updateProgressBar();
38
40
  self.updateListEntryIcon();
41
+ $('#finishedExampleCount').html( self.finishedExampleCount() );
39
42
  }
40
43
  };
41
44
 
42
45
  this.finishedExampleCount = function(){
43
- return this.passingExamples.length + this.pendingExamples.length + this.failingExamples.length;
46
+ return self.passingExamples.length + self.pendingExamples.length + self.failingExamples.length;
44
47
  };
45
48
 
46
49
  this.updateListEntryIcon = function(){
@@ -129,6 +132,8 @@ $(function(){
129
132
  },
130
133
 
131
134
  startNewIteration : function(timestamp, exampleCount){
135
+ $('#btn-run-specs').removeAttr('disabled');
136
+
132
137
  var templateVariables = {
133
138
  timestamp : timestamp,
134
139
  exampleCount : exampleCount,
@@ -208,7 +213,6 @@ $(function(){
208
213
  }) );
209
214
 
210
215
  $self.attr('disabled', 'disabled');
211
- setTimeout(function(){ $self.removeAttr('disabled'); }, 3500);
212
216
  }
213
217
  });
214
218
 
@@ -1,10 +1,11 @@
1
1
  !!! 5
2
2
  %html(lang="en")
3
3
  %head
4
+ %title Rspec Web Frontend
5
+
4
6
  %meta(charset="utf-8")
5
7
  %meta(name="apple-mobile-web-app-capable" content="yes")
6
8
  %meta(name="viewport" content="width=device-width, initial-scale=1.0")
7
- %title Rspec Web Frontend
8
9
 
9
10
  /[if lt IE 9]
10
11
  %script(type="text/javascript" src="http://html5shim.googlecode.com/svn/trunk/html5.js")
@@ -46,7 +47,7 @@
46
47
 
47
48
  <div class="row-fluid">
48
49
  <div class="span12">
49
- <h6><%= exampleCount %> Example<%= exampleCount > 1 ? "s" : "" %></h6>
50
+ <h6><span id="finishedExampleCount">0</span> of <%= exampleCount %> example<%= exampleCount > 1 ? "s" : "" %> finished</h6>
50
51
  </div>
51
52
  </div>
52
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-07 00:00:00.000000000Z
12
+ date: 2012-03-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: em-websocket
16
- requirement: &70360448929180 !ruby/object:Gem::Requirement
16
+ requirement: &70158387964680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70360448929180
24
+ version_requirements: *70158387964680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: haml
27
- requirement: &70360448928320 !ruby/object:Gem::Requirement
27
+ requirement: &70158387963980 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70360448928320
35
+ version_requirements: *70158387963980
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sass
38
- requirement: &70360448927220 !ruby/object:Gem::Requirement
38
+ requirement: &70158387963360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.1.14
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70360448927220
46
+ version_requirements: *70158387963360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sinatra
49
- requirement: &70360448919500 !ruby/object:Gem::Requirement
49
+ requirement: &70158387962480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.3.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70360448919500
57
+ version_requirements: *70158387962480
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70360448918640 !ruby/object:Gem::Requirement
60
+ requirement: &70158387959080 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.8.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70360448918640
68
+ version_requirements: *70158387959080
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: web-socket-ruby
71
- requirement: &70360448917000 !ruby/object:Gem::Requirement
71
+ requirement: &70158387957920 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 0.1.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70360448917000
79
+ version_requirements: *70158387957920
80
80
  description: A web front-end for RSpec tests.
81
81
  email: c00lryguy@gmail.com
82
82
  executables: