uspec 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/bin/uspec +2 -7
- data/lib/uspec/{exec.rb → cli.rb} +16 -3
- data/lib/uspec/stats.rb +2 -1
- data/lib/uspec/version.rb +1 -1
- data/uspec/cli_spec.rb +48 -0
- data/uspec/test_specs/broken_require_spec +1 -0
- metadata +6 -7
- data/uspec/exec_spec.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f5dce7ef226b32d0ffef1d178b04c11a474cb3f137bb8697244cec85ace59ad5
|
4
|
+
data.tar.gz: 9f80cd6442661e2993df1ec9ad7486999d435c962f39adc893db2335f05da4c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cd294e9ec21d0b5d48c2dee3328667e335f6a5c1922d7b28c6d392c146b0237eefa523b42217e6927dab206a453eff72e8f97b5133ec6d86096b3a23df7b037
|
7
|
+
data.tar.gz: 05f5582a527627d26fbe3563644feb5702fc56d398ac0b5685ffbb953499ba063c238281e175d1b85dcb76b777aed4e4ce05851470da40f27805af340e727461
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.3.7
|
data/bin/uspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require_relative '../uspec'
|
3
3
|
|
4
|
-
class Uspec::
|
4
|
+
class Uspec::CLI
|
5
5
|
class << self
|
6
6
|
def usage
|
7
7
|
warn "uspec - minimalistic ruby testing framework"
|
@@ -9,8 +9,16 @@ class Uspec::Exec
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def run_specs paths
|
12
|
-
|
13
|
-
|
12
|
+
uspec_cli = self.new paths
|
13
|
+
uspec_cli.run_paths
|
14
|
+
end
|
15
|
+
|
16
|
+
def invoke args
|
17
|
+
if (args & %w[-h --help -? /?]).empty? then
|
18
|
+
run_specs args
|
19
|
+
else
|
20
|
+
usage
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
16
24
|
|
@@ -46,6 +54,11 @@ class Uspec::Exec
|
|
46
54
|
else
|
47
55
|
warn "path not found: #{path}"
|
48
56
|
end
|
57
|
+
rescue LoadError => result
|
58
|
+
formatter = Uspec::Formatter.new
|
59
|
+
print ' -- FAILED TO LOAD TEST FILE DUE TO: '
|
60
|
+
Uspec::Stats.results << result
|
61
|
+
puts formatter.colorize(result, result.backtrace)
|
49
62
|
end
|
50
63
|
|
51
64
|
end
|
data/lib/uspec/stats.rb
CHANGED
@@ -14,7 +14,8 @@ module Uspec
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def exit_code
|
17
|
-
|
17
|
+
# checking for truthy isn't good enough, it must be exactly true!
|
18
|
+
failures = results.count{|result| result != true }
|
18
19
|
failures > 255 ? 255 : failures
|
19
20
|
end
|
20
21
|
end
|
data/lib/uspec/version.rb
CHANGED
data/uspec/cli_spec.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require_relative 'uspec_helper'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
spec 'shows usage' do
|
5
|
+
output = capture do
|
6
|
+
exec 'bin/uspec -h'
|
7
|
+
end
|
8
|
+
|
9
|
+
output.include? 'usage'
|
10
|
+
end
|
11
|
+
|
12
|
+
spec 'runs a path of specs' do
|
13
|
+
output = capture do
|
14
|
+
path = Pathname.new(__FILE__).parent.parent.join('example_specs').to_s
|
15
|
+
Uspec::CLI.run_specs Array(path)
|
16
|
+
end
|
17
|
+
|
18
|
+
output.include? 'I love passing tests'
|
19
|
+
end
|
20
|
+
|
21
|
+
spec 'runs an individual spec' do
|
22
|
+
output = capture do
|
23
|
+
path = Pathname.new(__FILE__).parent.parent.join('example_specs', 'example_spec.rb').to_s
|
24
|
+
Uspec::CLI.run_specs Array(path)
|
25
|
+
end
|
26
|
+
|
27
|
+
output.include? 'I love passing tests'
|
28
|
+
end
|
29
|
+
|
30
|
+
spec 'exits with failure status if a test has a broken require' do
|
31
|
+
path = Pathname.new(__FILE__).parent.join('test_specs', 'broken_require_spec')
|
32
|
+
|
33
|
+
capture do
|
34
|
+
exec "bin/uspec #{path}"
|
35
|
+
end
|
36
|
+
|
37
|
+
$?.exitstatus == 1 || $?
|
38
|
+
end
|
39
|
+
|
40
|
+
spec 'displays information about test file with broken require' do
|
41
|
+
path = Pathname.new(__FILE__).parent.join('test_specs', 'broken_require_spec')
|
42
|
+
|
43
|
+
output = capture do
|
44
|
+
exec "bin/uspec #{path}"
|
45
|
+
end
|
46
|
+
|
47
|
+
output.include? 'cannot load such file'
|
48
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "nonexistant"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Cook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Uspec is a shiny little spec framework for your apps! Unlike other testing
|
14
14
|
frameworks there's no need for matchers, there can only be one assertion per test,
|
@@ -32,13 +32,14 @@ files:
|
|
32
32
|
- example_specs/example_spec.rb
|
33
33
|
- example_specs/spec_helper.rb
|
34
34
|
- lib/uspec.rb
|
35
|
+
- lib/uspec/cli.rb
|
35
36
|
- lib/uspec/dsl.rb
|
36
|
-
- lib/uspec/exec.rb
|
37
37
|
- lib/uspec/formatter.rb
|
38
38
|
- lib/uspec/stats.rb
|
39
39
|
- lib/uspec/version.rb
|
40
40
|
- uspec.gemspec
|
41
|
-
- uspec/
|
41
|
+
- uspec/cli_spec.rb
|
42
|
+
- uspec/test_specs/broken_require_spec
|
42
43
|
- uspec/uspec_helper.rb
|
43
44
|
- uspec/uspec_spec.rb
|
44
45
|
homepage: http://github.com/acook/uspec#readme
|
@@ -59,10 +60,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
62
|
requirements: []
|
62
|
-
|
63
|
-
rubygems_version: 2.6.8
|
63
|
+
rubygems_version: 3.0.4
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: a shiny little spec framework for your apps!
|
67
67
|
test_files: []
|
68
|
-
has_rdoc:
|
data/uspec/exec_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require_relative 'uspec_helper'
|
2
|
-
|
3
|
-
spec 'shows usage' do
|
4
|
-
output = capture do
|
5
|
-
exec 'bin/uspec -h'
|
6
|
-
end
|
7
|
-
|
8
|
-
output.include? 'usage'
|
9
|
-
end
|
10
|
-
|
11
|
-
spec 'runs a path of specs' do
|
12
|
-
output = capture do
|
13
|
-
path = Pathname.new(__FILE__).parent.parent.join('example_specs').to_s
|
14
|
-
Uspec::Exec.run_specs Array(path)
|
15
|
-
end
|
16
|
-
|
17
|
-
output.include? 'I love passing tests'
|
18
|
-
end
|
19
|
-
|
20
|
-
spec 'runs an individual spec' do
|
21
|
-
output = capture do
|
22
|
-
path = Pathname.new(__FILE__).parent.parent.join('example_specs', 'example_spec.rb').to_s
|
23
|
-
Uspec::Exec.run_specs Array(path)
|
24
|
-
end
|
25
|
-
|
26
|
-
output.include? 'I love passing tests'
|
27
|
-
end
|