uspec 0.2.1 → 0.2.2

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
2
  SHA256:
3
- metadata.gz: 65de448e566c6f625bd228e6581a0ee78bd8811a0189e04f4588d7474201e516
4
- data.tar.gz: 62ba89fc56bdd1fb21cf2709ab8441ed0ad9cbe3f5426ce1719d8c36933161d7
3
+ metadata.gz: 62e31cb81d9310131f0336f4a946e8adbb499cf36864a83d76eaf0054821dff0
4
+ data.tar.gz: c91492ba7e80c49e9781af2ce08f5396e269d0f41148c61d682d1d89a603f71d
5
5
  SHA512:
6
- metadata.gz: f9353937b8b7e4b44ed2ea214fcb69ce1c0558d7774e10dedd4d071e20ad10f1fca8485e0063bacdf614d25389a9893439f4bafd0617347fd91649b85c9284d1
7
- data.tar.gz: 87f381e5c1f7f715c28543f47531589ef8344266d648e729c9d6fb01d7f9bfb7a79a966b2437c7f76e8a7d995dc0d378563b819881cb8b46b92e0b5dbbccee00
6
+ metadata.gz: a0c3a167ad68a9ca32439346761a1520360bf84c52097cf0ed1356b7569c810581d261e65a0b22fae4201415e2e517b589ac6f6dc5c6b95747e41d7dae2f3211
7
+ data.tar.gz: 7b8e868bf9d42b008f9b5ee5fc8aea44b557c9d59e7021a500dcf1a08c4ec30a7316c0c6fdaa498ae02fab84b498707f7ce6036fc424b9cc6eba6967ca5eefa9
@@ -0,0 +1,56 @@
1
+ # Rubocop override settings
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.0
5
+
6
+ Metrics/LineLength:
7
+ Max: 120
8
+ Exclude:
9
+ - config_module.gemspec
10
+ - "uspec/**/*"
11
+
12
+ Naming/PredicateName:
13
+ Enabled: false
14
+
15
+ Style/PreferredHashMethods:
16
+ Exclude:
17
+ - "**/*"
18
+
19
+ Style/Documentation:
20
+ Enabled: false
21
+
22
+ Style/MethodDefParentheses:
23
+ Enabled: false
24
+
25
+ Style/ParallelAssignment:
26
+ Enabled: false
27
+
28
+ Style/SingleLineMethods:
29
+ Enabled: false
30
+
31
+ Style/Alias:
32
+ Enabled: false
33
+
34
+ Style/CaseEquality:
35
+ Enabled: false
36
+
37
+ Style/SymbolArray:
38
+ Enabled: false
39
+
40
+ Bundler/OrderedGems:
41
+ Enabled: false
42
+
43
+ Style/StringLiterals:
44
+ EnforcedStyle: double_quotes
45
+
46
+ Style/StringLiteralsInInterpolation:
47
+ EnforcedStyle: double_quotes
48
+
49
+ Layout/AccessModifierIndentation:
50
+ EnforcedStyle: outdent
51
+
52
+ Style/EnforcedStyleForMultiline:
53
+ EnforcedStyle: consistent_comma
54
+
55
+ Naming/RescuedExceptionsVariableName:
56
+ PreferredName: error
@@ -3,8 +3,9 @@ Uspec
3
3
 
4
4
  Uspec is a shiny little testing framework for your apps!
5
5
 
6
- [![Build Status](https://travis-ci.org/acook/uspec.png?branch=master)](https://travis-ci.org/acook/uspec)
7
- [![Code Climate](https://codeclimate.com/github/acook/uspec.png)](https://codeclimate.com/github/acook/uspec)
6
+ [![Gem Version](https://img.shields.io/gem/v/uspec.svg?style=for-the-badge)](https://rubygems.org/gems/uspec/)
7
+ [![Build Status](https://img.shields.io/travis/acook/uspec.svg?style=for-the-badge)](https://travis-ci.org/acook/uspec)
8
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/acook/uspec.svg?style=for-the-badge)](https://codeclimate.com/github/acook/uspec)
8
9
 
9
10
  Philosophy / Why Uspec?
10
11
  -----------------------
@@ -12,7 +12,7 @@ module Uspec
12
12
 
13
13
  begin
14
14
  raw_result = yield
15
- rescue => raw_result
15
+ rescue Exception => raw_result
16
16
  end
17
17
 
18
18
  result = Result.new description, raw_result, caller
@@ -1,4 +1,5 @@
1
1
  require_relative "terminal"
2
+ require "toisb"
2
3
 
3
4
  module Uspec
4
5
  class Result
@@ -8,8 +9,9 @@ module Uspec
8
9
  @spec = spec
9
10
  @raw = raw
10
11
  @source = source
12
+ @handler = ::TOISB.wrap raw
11
13
  end
12
- attr_reader :spec, :raw, :source
14
+ attr_reader :spec, :raw, :source, :handler
13
15
 
14
16
  def pretty
15
17
  if raw == true then
@@ -1,3 +1,3 @@
1
1
  module Uspec
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -29,12 +29,12 @@ spec "ensure parent object of BasicObject subclasses get a useful error message"
29
29
  actual.include?(expected) || result.inspector
30
30
  end
31
31
 
32
- class ::InspectFail; def inspect; raise; end; end
32
+ class ::InspectFail; def inspect; raise RuntimeError, "This error is intentional and part of the test."; end; end
33
33
  inspect_fail = InspectFail.new
34
34
 
35
35
  spec "display a useful error message when a user-defined inspect method fails" do
36
36
  result = Uspec::Result.new "Inspect Fail Result", inspect_fail, []
37
- expected = "raises an error"
37
+ expected = "raises an exception"
38
38
  actual = result.pretty
39
39
  actual.include?(expected) || result.inspector
40
40
  end
@@ -10,6 +10,16 @@ spec 'catches errors' do
10
10
  output.include? 'Exception'
11
11
  end
12
12
 
13
+ spec 'catches even non-StandardError-subclass exceptions' do
14
+ output = capture do
15
+ spec 'not implemented error' do
16
+ raise ::NotImplementedError, 'test exception'
17
+ end
18
+ end
19
+
20
+ output.include? 'Exception'
21
+ end
22
+
13
23
  spec 'complains when spec block returns non boolean' do
14
24
  output = capture do
15
25
  spec 'whatever' do
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.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony M. Cook
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -50,6 +50,7 @@ extra_rdoc_files: []
50
50
  files:
51
51
  - ".editorconfig"
52
52
  - ".gitignore"
53
+ - ".rubocop.yml"
53
54
  - ".ruby-gemset"
54
55
  - ".ruby-version"
55
56
  - ".travis.yml"