dbtap 0.0.2 → 0.0.3

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: 039786803ec29d229e44f8a27dc6e9386f87487b
4
- data.tar.gz: 9f5bcbd15573227c4b48ffc5aeebd197e533f198
3
+ metadata.gz: 939d118308673dee3dc9c2e14186763478b08af9
4
+ data.tar.gz: 2f7f4880f88d9906d5860f1aa16521719f3b136f
5
5
  SHA512:
6
- metadata.gz: d9201218165072d47ff44998463ab82cb77b5d695595e55b9c0d0d695322b18cad5b71d38d3c8f3b0842565cb903360515c16d44804ae0002c7a5a5fba038c0b
7
- data.tar.gz: cb952364207d30940c1b64322c360341d0b0ada7b46978dcb2819a1f9995e423d0a1d606ec03a88ec429a62a20ffc7e3c9e76e00b84da2213369ad361ed9419c
6
+ metadata.gz: 9f94b2b94e94963b0c5b13b4fbe2726e239dd598a2ad972d44a1173d0b8b5820e59bc791a13f82332108038201d5be53a007cbd69f2d5d4e2d2fd2521317f910
7
+ data.tar.gz: acd7edcc25879cb636a695db92711ff031941d55dcee3387b18dd1227107b858b91dad3c6a97753544f6cfe0110facbf54da65b104beb63f129243ad9d316601
@@ -1,6 +1,22 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 0.0.3 - 2015-12-11
5
+
6
+ ### Added
7
+ - Print SQL and error if a test raises a Sequel::DatabaseError
8
+ - For set_eq, save a copy of all results to /tmp/actual.csv
9
+
10
+ ### Deprecated
11
+ - Nothing.
12
+
13
+ ### Removed
14
+ - Nothing.
15
+
16
+ ### Fixed
17
+ - PerformsWithin reports too fast/slow as a factor of time.
18
+
19
+
4
20
  ## 0.0.2 - 2014-08-20
5
21
 
6
22
  ### Added
data/Gemfile CHANGED
@@ -2,4 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in dbtap.gemspec
4
4
  gemspec
5
- gem 'pg' # ADDED BY SEQUELIZER
@@ -10,6 +10,7 @@ module Dbtap
10
10
  attr :tests
11
11
  def initialize
12
12
  @tests = []
13
+ db.extension :error_sql
13
14
  end
14
15
 
15
16
  # Drives the evaluation of each test, emitting TAP-compliant messages
@@ -17,10 +18,15 @@ module Dbtap
17
18
  def run
18
19
  puts (1..tests.length).to_s
19
20
  tests.each_with_index do |test, i|
20
- if test.is_ok?
21
- ok(test, i)
22
- else
23
- not_ok(test, i)
21
+ begin
22
+ if test.is_ok?
23
+ ok(test, i)
24
+ else
25
+ not_ok(test, i)
26
+ end
27
+ rescue Sequel::DatabaseError
28
+ puts $!.sql
29
+ raise $!
24
30
  end
25
31
  end
26
32
  end
@@ -28,9 +28,9 @@ module Dbtap
28
28
  def errors
29
29
  output = []
30
30
  if time_diff < 0
31
- output << "too slow by #{time_proportion}"
31
+ output << "too slow by factor of #{time_factor}"
32
32
  else
33
- output << "too fast by #{time_proportion}"
33
+ output << "too fast by factor of #{time_factor}"
34
34
  end
35
35
  output << "average runtime: #{elapsed_time} ms"
36
36
  output << "desired average: #{expected_time} +/- #{delta} ms"
@@ -60,5 +60,10 @@ module Dbtap
60
60
  def time_proportion
61
61
  elapsed_time.to_f / expected_time
62
62
  end
63
+
64
+ def time_factor
65
+ return time_proportion if time_proportion > 1
66
+ return (1 / time_proportion)
67
+ end
63
68
  end
64
69
  end
@@ -1,3 +1,4 @@
1
+ require 'csv'
1
2
  require_relative 'tester'
2
3
 
3
4
  module Dbtap
@@ -25,6 +26,7 @@ module Dbtap
25
26
  end
26
27
 
27
28
  def errors
29
+ drop_csv
28
30
  output = []
29
31
  unless missing.empty?
30
32
  output << "Missing #{missing.count}/#{expected_count} Records:"
@@ -49,5 +51,18 @@ module Dbtap
49
51
  def expected_count
50
52
  @expected_count = expected.count
51
53
  end
54
+
55
+ def drop_csv
56
+ rows = actual.all
57
+ CSV.open('/tmp/actual.csv', 'w') do |csv|
58
+ unless rows.empty?
59
+ csv << rows.first.keys
60
+ end
61
+
62
+ rows.each do |row|
63
+ csv << row.values
64
+ end
65
+ end
66
+ end
52
67
  end
53
68
  end
@@ -1,3 +1,3 @@
1
1
  module Dbtap
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbtap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Duryea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-21 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.2.2
119
+ rubygems_version: 2.4.5.1
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Write database-agnostic, TAP-emitting unit tests for your database