getting_dumped 0.0.2.4 → 0.0.3.0
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.
data/lib/getting_dumped/app.rb
CHANGED
@@ -3,12 +3,12 @@ require "sinatra"
|
|
3
3
|
|
4
4
|
class GettingDumpedServer < Sinatra::Application
|
5
5
|
get '/runs' do
|
6
|
-
@runs =
|
6
|
+
@runs = DB[:runs]
|
7
7
|
erb :runs
|
8
8
|
end
|
9
9
|
|
10
10
|
get '/run/:id' do
|
11
|
-
@examples =
|
11
|
+
@examples = DB[:examples].where("run_id = ?", params[:id]).all
|
12
12
|
erb :examples
|
13
13
|
end
|
14
14
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sequel'
|
3
|
+
|
4
|
+
DB = Sequel.connect("sqlite://db/examples.db")
|
5
|
+
DB.create_table? :examples do
|
6
|
+
primary_key :id
|
7
|
+
String :name
|
8
|
+
DateTime :started_at
|
9
|
+
DateTime :finished_at
|
10
|
+
Float :run_time
|
11
|
+
String :status
|
12
|
+
String :backtrace
|
13
|
+
String :failure
|
14
|
+
String :exception
|
15
|
+
Integer :run_id
|
16
|
+
end
|
17
|
+
|
18
|
+
DB.create_table? :runs do
|
19
|
+
primary_key :id
|
20
|
+
DateTime :started_at
|
21
|
+
DateTime :ended_at
|
22
|
+
String :run_time
|
23
|
+
String :success
|
24
|
+
end
|
@@ -1,38 +1,5 @@
|
|
1
|
-
require 'data_mapper'
|
2
|
-
require 'dm-migrations'
|
3
|
-
|
4
1
|
unless File.exists?("db")
|
5
2
|
Dir.mkdir('db')
|
6
3
|
end
|
7
|
-
|
8
|
-
|
9
|
-
class Example
|
10
|
-
include DataMapper::Resource
|
11
|
-
|
12
|
-
property :id, Serial
|
13
|
-
property :name, Text
|
14
|
-
property :started_at, DateTime
|
15
|
-
property :finished_at, DateTime
|
16
|
-
property :run_time, Float
|
17
|
-
property :status, String
|
18
|
-
property :backtrace, Text
|
19
|
-
property :failure, String
|
20
|
-
property :exception, Text
|
21
|
-
|
22
|
-
belongs_to :run
|
23
|
-
end
|
24
|
-
|
25
|
-
class Run
|
26
|
-
include DataMapper::Resource
|
27
|
-
|
28
|
-
property :id, Serial
|
29
|
-
property :started_at, DateTime
|
30
|
-
property :ended_at, DateTime
|
31
|
-
property :run_time, String
|
32
|
-
property :success, String
|
33
|
-
|
34
|
-
has n, :examples
|
35
|
-
end
|
36
|
-
|
37
|
-
DataMapper.finalize
|
38
|
-
DataMapper.auto_upgrade!
|
4
|
+
# Use in-memory database for now.
|
5
|
+
DB = Sequel.sqlite
|
@@ -2,14 +2,14 @@
|
|
2
2
|
<tbody>
|
3
3
|
<% @examples.each do |example| %>
|
4
4
|
<tr>
|
5
|
-
<td><%= example
|
6
|
-
<td><%= example
|
7
|
-
<td><%= example
|
8
|
-
<td><%= example
|
9
|
-
<td><%= example
|
10
|
-
<td><%= example
|
11
|
-
<td><%= example
|
12
|
-
<td><%= example
|
5
|
+
<td><%= example[:name] %></td>
|
6
|
+
<td><%= example[:started_at] %></td>
|
7
|
+
<td><%= example[:finished_at] %></td>
|
8
|
+
<td><%= example[:run_time] %></td>
|
9
|
+
<td><%= example[:status] %></td>
|
10
|
+
<td><%= example[:backtrace] %></td>
|
11
|
+
<td><%= example[:failure] %></td>
|
12
|
+
<td><%= example[:exception] %></td>
|
13
13
|
</tr>
|
14
14
|
<% end %>
|
15
15
|
</tbody>
|
@@ -2,11 +2,11 @@
|
|
2
2
|
<tbody>
|
3
3
|
<% @runs.all.each do |run|%>
|
4
4
|
<tr>
|
5
|
-
<td><a href="run/<%=run
|
6
|
-
<td><%= run
|
7
|
-
<td><%= run
|
8
|
-
<td><%= run
|
9
|
-
<td><%= run
|
5
|
+
<td><a href="run/<%=run[:id]%>">link</a></td>
|
6
|
+
<td><%= run[:started_at] %></td>
|
7
|
+
<td><%= run[:ended_at] %></td>
|
8
|
+
<td><%= run[:run_time] %></td>
|
9
|
+
<td><%= run[:success] %></td>
|
10
10
|
</tr>
|
11
11
|
<% end %>
|
12
12
|
</tbody>
|
data/lib/getting_dumped.rb
CHANGED
@@ -1,59 +1,73 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require 'rspec/core/formatters/base_formatter'
|
3
|
-
require 'getting_dumped/
|
3
|
+
require 'getting_dumped/migrations/create_tables'
|
4
|
+
|
4
5
|
|
5
6
|
class GettingDumped < RSpec::Core::Formatters::BaseFormatter
|
6
7
|
def initialize(options)
|
7
|
-
super
|
8
|
+
super(options)
|
9
|
+
@run_started_at = Time.now
|
10
|
+
@run = DB[:runs]
|
11
|
+
@example_db = DB[:examples]
|
8
12
|
@success = true
|
9
|
-
@
|
13
|
+
@run_id = @run.insert(:started_at => Time.now)
|
10
14
|
end
|
11
15
|
|
12
16
|
def start(count)
|
13
|
-
super
|
17
|
+
super(count)
|
14
18
|
end
|
15
19
|
|
16
20
|
def example_started(example)
|
17
|
-
super
|
21
|
+
super(example)
|
18
22
|
end
|
19
23
|
|
20
24
|
def example_pending(example)
|
21
|
-
super
|
25
|
+
super(example)
|
22
26
|
save_example(example)
|
23
27
|
end
|
24
28
|
|
25
29
|
def example_passed(example)
|
26
|
-
super
|
30
|
+
super(example)
|
27
31
|
save_example(example)
|
28
32
|
end
|
29
33
|
|
30
34
|
def example_failed(example)
|
31
|
-
super
|
35
|
+
super(example)
|
32
36
|
save_example(example)
|
33
37
|
@success = false
|
34
38
|
end
|
35
39
|
|
36
40
|
def start_dump
|
37
41
|
super
|
38
|
-
time =
|
39
|
-
@run.
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
time = Time.now
|
43
|
+
@run.where('id = ?', @run_id).update(
|
44
|
+
:ended_at => time,
|
45
|
+
:success => @success,
|
46
|
+
:run_time => time - @run_started_at
|
47
|
+
)
|
43
48
|
end
|
44
49
|
|
45
50
|
private
|
46
51
|
|
47
52
|
def save_example(example)
|
48
53
|
metadata = example.metadata[:execution_result]
|
49
|
-
|
50
|
-
|
54
|
+
exception = nil
|
55
|
+
backtrace = nil
|
56
|
+
exception = nil
|
51
57
|
if metadata[:status] == "failed"
|
52
58
|
exception = metadata[:exception_encountered] || metadata[:exception] # rspec 2.0 || rspec 2.2
|
53
|
-
|
54
|
-
|
59
|
+
backtrace = exception.backtrace
|
60
|
+
exception = read_failed_line(exception, example)
|
55
61
|
end
|
56
|
-
|
62
|
+
@example_db.insert(:name => example.full_description,
|
63
|
+
:status => metadata[:status],
|
64
|
+
:run_id => @run_id,
|
65
|
+
:run_time => metadata[:run_time],
|
66
|
+
:started_at => DateTime.parse(metadata[:started_at].to_s),
|
67
|
+
:finished_at => DateTime.parse(metadata[:finished_at].to_s),
|
68
|
+
:exception => exception.to_s,
|
69
|
+
:backtrace => backtrace.to_s
|
70
|
+
)
|
57
71
|
end
|
58
72
|
|
59
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getting_dumped
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: sequel
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: sqlite3
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
@@ -117,6 +117,7 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- lib/getting_dumped.rb
|
119
119
|
- lib/getting_dumped/app.rb
|
120
|
+
- lib/getting_dumped/migrations/create_tables.rb
|
120
121
|
- lib/getting_dumped/models.rb
|
121
122
|
- lib/getting_dumped/views/examples.erb
|
122
123
|
- lib/getting_dumped/views/runs.erb
|