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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f6a6363a2a59ed141811ddbd906b6a47a1494a0b
4
- data.tar.gz: 5d21b182f77d0d4101d4a4236775e527aa05972d
2
+ SHA256:
3
+ metadata.gz: f5dce7ef226b32d0ffef1d178b04c11a474cb3f137bb8697244cec85ace59ad5
4
+ data.tar.gz: 9f80cd6442661e2993df1ec9ad7486999d435c962f39adc893db2335f05da4c9
5
5
  SHA512:
6
- metadata.gz: 28cd24aed39ea930141a5f0e72ed86c02221610ab610d8b8359e46d4002898b578a554bbf903b5f524e9552edf441f559ce004c356b4abd259215d3720f8df6b
7
- data.tar.gz: e54033546d92f8f89651e49df226c293d973952d77d4fd6d9bda32fb3f8f876d6d54cd14e7f7306ca266f6d83d9812f3d7ca9d036c8a7e3baa8fa25e5549df56
6
+ metadata.gz: 6cd294e9ec21d0b5d48c2dee3328667e335f6a5c1922d7b28c6d392c146b0237eefa523b42217e6927dab206a453eff72e8f97b5133ec6d86096b3a23df7b037
7
+ data.tar.gz: 05f5582a527627d26fbe3563644feb5702fc56d398ac0b5685ffbb953499ba063c238281e175d1b85dcb76b777aed4e4ce05851470da40f27805af340e727461
@@ -1 +1 @@
1
- ruby-2.2.3
1
+ 2.3.7
data/bin/uspec CHANGED
@@ -1,9 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative '../lib/uspec/exec'
4
-
5
- if (ARGV & %w{-h --help -? /? /help}).empty? then
6
- Uspec::Exec.run_specs ARGV
7
- else
8
- Uspec::Exec.usage
9
- end
3
+ require_relative '../lib/uspec/cli'
4
+ Uspec::CLI.invoke ARGV
@@ -1,7 +1,7 @@
1
1
  require 'pathname'
2
2
  require_relative '../uspec'
3
3
 
4
- class Uspec::Exec
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
- uspec_exec = self.new paths
13
- uspec_exec.run_paths
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
@@ -14,7 +14,8 @@ module Uspec
14
14
  end
15
15
 
16
16
  def exit_code
17
- failures = results.count{|result| !result }
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
@@ -1,3 +1,3 @@
1
1
  module Uspec
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -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.0
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: 2016-12-22 00:00:00.000000000 Z
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/exec_spec.rb
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
- rubyforge_project:
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:
@@ -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