uspec 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -5
- data/.ruby-version +1 -1
- data/README.markdown +9 -48
- data/lib/uspec/dsl.rb +1 -1
- data/lib/uspec/result.rb +1 -1
- data/lib/uspec/version.rb +1 -1
- data/uspec/cli_spec.rb +2 -1
- data/uspec/result_spec.rb +3 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6763c9a1b9995386967bfb824889265c9bee560a86012728055bb107a4dd910
|
4
|
+
data.tar.gz: 74912e14810a2b03d596addcb14fe3696cd79efd3f8c104c49a4d65055aaca87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ead8cbbee34c75b337685d1c3533c6129d39d870cd9abf94b7365317760f6c42aeab6a7d30749fab352139c947669514c2870d3542bbcd1e2160e020f5574fcc
|
7
|
+
data.tar.gz: cfa24d4154e3b0a95257cd544fa45451c551e460cb3a7f6ac995c3446a1a09623729d03843c41bace49adfda04ea1a58e42cb1eb62e431a4e149d83afaa85e13
|
data/.circleci/config.yml
CHANGED
@@ -4,8 +4,6 @@ orbs:
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
build:
|
7
|
-
docker:
|
8
|
-
- image: circleci/ruby:2.6.3-stretch-node
|
9
7
|
executor: ruby/default
|
10
8
|
steps:
|
11
9
|
- checkout
|
@@ -13,9 +11,6 @@ jobs:
|
|
13
11
|
name: Which bundler?
|
14
12
|
command: bundle -v
|
15
13
|
- ruby/bundle-install
|
16
|
-
test:
|
17
|
-
executor: ruby/default
|
18
|
-
steps:
|
19
14
|
- run:
|
20
15
|
name: Uspec tests
|
21
16
|
command: bundle exec uspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.1
|
data/README.markdown
CHANGED
@@ -24,7 +24,7 @@ This also means *no monkey patching* core classes!
|
|
24
24
|
Uspec's output is in beautiful ansi technicolor,
|
25
25
|
with red for failures, green for successes, and yellow for pending specs. Here's a screenshot:
|
26
26
|
|
27
|
-
![Screenshot!](
|
27
|
+
![Screenshot!](https://i.imgur.com/Baqggck.png)
|
28
28
|
|
29
29
|
Uspec is tiny, painless, and easy to use. Download it and give it a try!
|
30
30
|
|
@@ -90,7 +90,7 @@ A brief explanation of `uspec`'s output to show you what it can do!
|
|
90
90
|
|
91
91
|
### Success
|
92
92
|
|
93
|
-
If a spec passes:
|
93
|
+
If a spec passes (returns true):
|
94
94
|
|
95
95
|
```
|
96
96
|
-- AwesomeMcCoolname.generate creates a cool name: true
|
@@ -98,7 +98,7 @@ If a spec passes:
|
|
98
98
|
|
99
99
|
### Failure
|
100
100
|
|
101
|
-
If a spec fails:
|
101
|
+
If a spec fails (returns false):
|
102
102
|
|
103
103
|
```
|
104
104
|
-- AwesomeMcCoolname.generate creates a cool name: false
|
@@ -106,13 +106,13 @@ If a spec fails:
|
|
106
106
|
|
107
107
|
### Exception
|
108
108
|
|
109
|
-
If the spec
|
109
|
+
If the spec encounters an error (raises an Exception):
|
110
110
|
|
111
111
|
```
|
112
112
|
-- AwesomeMcCoolname.generate creates a cool name: Exception
|
113
113
|
|
114
114
|
Encountered an Exception while running spec
|
115
|
-
at uspec/awesome_mc_coolname_spec.rb:3: in `<main>'
|
115
|
+
in spec at uspec/awesome_mc_coolname_spec.rb:3: in `<main>'
|
116
116
|
|
117
117
|
RuntimeError < StandardError: 'wtf'
|
118
118
|
|
@@ -130,13 +130,13 @@ spec 'AwesomeMcCoolname.generate creates a cool name' do
|
|
130
130
|
end
|
131
131
|
```
|
132
132
|
|
133
|
-
Then Uspec will let you know:
|
133
|
+
Then Uspec will let you know so you can debug it:
|
134
134
|
|
135
135
|
```ruby
|
136
|
-
-- AwesomeMcCoolname.generate creates a badass name:
|
136
|
+
-- AwesomeMcCoolname.generate creates a badass name: Failed
|
137
137
|
|
138
138
|
Spec did not return a boolean value
|
139
|
-
at uspec/awesome_mc_coolname_spec.rb:6: in `<main>'
|
139
|
+
in spec at uspec/awesome_mc_coolname_spec.rb:6: in `<main>'
|
140
140
|
|
141
141
|
Integer < Numeric: 5
|
142
142
|
```
|
@@ -206,45 +206,6 @@ Mocks, Spies, Stubs, and More!
|
|
206
206
|
|
207
207
|
Since `uspec` is a very straight forward testing utility it is easy to use any of the standard Ruby mocking frameworks with it. However, the [Impasta gem](https://github.com/acook/impasta) was made specifically for simple but comprehensive mocking, stubbing, and spying.
|
208
208
|
|
209
|
-
Assertions & Debugging
|
210
|
-
----------------------
|
211
|
-
|
212
|
-
You can also use `uspec` to track assertions in an application or any object you want. Every spec block you use will be tracked and recorded. It's really no problem at all to do.
|
213
|
-
|
214
|
-
You can load Uspec's features directly into a class and use its DSL:
|
215
|
-
|
216
|
-
```ruby
|
217
|
-
require 'uspec'
|
218
|
-
|
219
|
-
class MyFoo
|
220
|
-
extend Uspec::DSL
|
221
|
-
|
222
|
-
def assert
|
223
|
-
spec 'foo is valid' do
|
224
|
-
false
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
MyFoo.new.assert
|
230
|
-
```
|
231
|
-
|
232
|
-
Assertions will be displayed as they occur, success or failure along with any informative output.
|
233
|
-
If there are any specs that fail, when your application exits its error code will equal the number of failures.
|
234
|
-
|
235
|
-
```
|
236
|
-
$ ruby foo.rb
|
237
|
-
-- foo is valid: false
|
238
|
-
$ echo $?
|
239
|
-
1
|
240
|
-
```
|
241
|
-
|
242
|
-
Uspec is just Ruby
|
243
|
-
------------------
|
244
|
-
|
245
|
-
If for some reason you don't want to use the `uspec` command, you can `require 'uspec'` and `extend Uspec::DSL`.
|
246
|
-
From there you can just run the file with ruby: `ruby my_test_spec.rb`
|
247
|
-
|
248
209
|
Contributing
|
249
210
|
------------
|
250
211
|
|
@@ -257,4 +218,4 @@ Contributing
|
|
257
218
|
Author
|
258
219
|
------
|
259
220
|
|
260
|
-
> Anthony M. Cook 2013-
|
221
|
+
> Anthony M. Cook 2013-2021
|
data/lib/uspec/dsl.rb
CHANGED
data/lib/uspec/result.rb
CHANGED
@@ -33,7 +33,7 @@ module Uspec
|
|
33
33
|
red('Failed'), vspace,
|
34
34
|
hspace, 'Spec did not return a boolean value ', newline,
|
35
35
|
hspace, 'in spec at ', source.first, vspace,
|
36
|
-
hspace, red(subklassinfo), inspector, newline
|
36
|
+
hspace, red(subklassinfo), inspector, (Class === raw ? ' Class' : ''), newline
|
37
37
|
].join
|
38
38
|
end
|
39
39
|
end
|
data/lib/uspec/version.rb
CHANGED
data/uspec/cli_spec.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative 'uspec_helper'
|
2
|
-
require 'open3'
|
3
2
|
|
4
3
|
spec 'shows usage' do
|
5
4
|
output = capture do
|
@@ -9,6 +8,8 @@ spec 'shows usage' do
|
|
9
8
|
output.include? 'usage'
|
10
9
|
end
|
11
10
|
|
11
|
+
spec 'pending test doesn\'t crash'
|
12
|
+
|
12
13
|
spec 'runs a path of specs' do
|
13
14
|
output = capture do
|
14
15
|
path = Pathname.new(__FILE__).parent.parent.join('example_specs').to_s
|
data/uspec/result_spec.rb
CHANGED
@@ -13,7 +13,7 @@ end
|
|
13
13
|
class ::TestObject < BasicObject; end
|
14
14
|
obj = TestObject.new
|
15
15
|
|
16
|
-
spec "ensure BasicObject
|
16
|
+
spec "ensure BasicObject subclass instances work" do
|
17
17
|
result = Uspec::Result.new "BasicObject Subclass Result", obj, []
|
18
18
|
expected = "#<BasicObject/TestObject:"
|
19
19
|
actual = result.pretty
|
@@ -22,7 +22,7 @@ end
|
|
22
22
|
|
23
23
|
spec "display basic info about Object" do
|
24
24
|
result = Uspec::Result.new "Object Result", Object.new, []
|
25
|
-
expected = "Object < BasicObject"
|
25
|
+
expected = "Object < BasicObject: \e[0m#<Object:"
|
26
26
|
actual = result.pretty
|
27
27
|
actual.include?(expected) || result.pretty
|
28
28
|
end
|
@@ -36,8 +36,7 @@ end
|
|
36
36
|
|
37
37
|
spec "display basic info about Array class" do
|
38
38
|
result = Uspec::Result.new "Array Class Result", Array, []
|
39
|
-
|
40
|
-
expected = "#<Class:Object> < #<Class:BasicObject>: \e[0mArray"
|
39
|
+
expected = "Class < Module: \e[0mArray Class"
|
41
40
|
actual = result.pretty
|
42
41
|
actual.include?(expected) || result.pretty
|
43
42
|
end
|
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: 1.0.
|
4
|
+
version: 1.0.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: 2021-
|
11
|
+
date: 2021-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: that_object_is_so_basic
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
110
|
+
rubygems_version: 3.2.15
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: a shiny little spec framework for your apps!
|