m-spec 0.2.2 → 0.2.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 +4 -4
- data/README.md +1 -1
- data/lib/m-spec.rb +2 -0
- data/lib/m-spec/core/helpers/readable.rb +4 -0
- data/lib/m-spec/core/matchers/output.rb +3 -3
- data/lib/m-spec/core/matchers/raise_error.rb +31 -0
- data/lib/m-spec/core/spec_result.rb +1 -1
- data/lib/m-spec/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f6acd7d54cf75d89e1c6775a87596f48765d537726dbde5bfb9f7edbf94d8b3
|
|
4
|
+
data.tar.gz: dc0fc6487f6b34ebb5bed6fad56c1eaf9b8fb7a834d302deeafd95095fa5433a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 709cbf7e8ac930b83c63c575dbac520bdf49d56eaf9c479f917504f1400e0f2f382426cab4639c3ceae3a17b1aa99dee31151aceffdaa441ee3f457ad96a0a1a
|
|
7
|
+
data.tar.gz: d64e4dd9cad0bcd54a0c988fa733d53de9a94df8030605d79c01a03632c29bad3ae5977394b736a403dd5ecd727c6fbb0faa01509b249d552013c63e5dd3184b
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mspec
|
|
2
2
|
|
|
3
|
-
The lightest-weight spec framework in ruby. Built for learning at [Makers](https://makers.tech). You have
|
|
3
|
+
The lightest-weight spec framework in ruby. Built for learning at [Makers](https://makers.tech). You have three matchers, an equality matcher, an output matcher and an error matcher. Test setup and teardown is your responsibility. For additional features, you must extend the gem.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
data/lib/m-spec.rb
CHANGED
|
@@ -9,6 +9,8 @@ require "m-spec/core/spec_example"
|
|
|
9
9
|
require "m-spec/core/specs"
|
|
10
10
|
require "m-spec/core/matchers/equal"
|
|
11
11
|
require "m-spec/core/matchers/output"
|
|
12
|
+
require "m-spec/core/matchers/raise_error"
|
|
13
|
+
|
|
12
14
|
require "m-spec/core/helpers/readable"
|
|
13
15
|
|
|
14
16
|
require "m-spec/mocks/allow"
|
|
@@ -3,7 +3,7 @@ require 'stringio'
|
|
|
3
3
|
module Mspec
|
|
4
4
|
module Matchers
|
|
5
5
|
class Output
|
|
6
|
-
attr_reader :value, :
|
|
6
|
+
attr_reader :value, :actual
|
|
7
7
|
|
|
8
8
|
def initialize(value)
|
|
9
9
|
@value = value
|
|
@@ -13,9 +13,9 @@ module Mspec
|
|
|
13
13
|
output = mock_output do
|
|
14
14
|
block.call
|
|
15
15
|
end
|
|
16
|
-
@
|
|
16
|
+
@actual = output.string
|
|
17
17
|
|
|
18
|
-
@value == @
|
|
18
|
+
@value == @actual
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
private
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'stringio'
|
|
2
|
+
|
|
3
|
+
module Mspec
|
|
4
|
+
module Matchers
|
|
5
|
+
class RaiseError
|
|
6
|
+
attr_reader :value, :actual
|
|
7
|
+
|
|
8
|
+
def initialize(value)
|
|
9
|
+
@value = value
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def check(block)
|
|
13
|
+
@actual = catch_error do
|
|
14
|
+
block.call
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@value == @actual
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def catch_error(&block)
|
|
23
|
+
begin
|
|
24
|
+
block.call
|
|
25
|
+
rescue StandardError => e
|
|
26
|
+
e.class
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/m-spec/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: m-spec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Edward Withers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-08-
|
|
11
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubocop
|
|
@@ -76,6 +76,7 @@ files:
|
|
|
76
76
|
- lib/m-spec/core/helpers/readable.rb
|
|
77
77
|
- lib/m-spec/core/matchers/equal.rb
|
|
78
78
|
- lib/m-spec/core/matchers/output.rb
|
|
79
|
+
- lib/m-spec/core/matchers/raise_error.rb
|
|
79
80
|
- lib/m-spec/core/spec_error.rb
|
|
80
81
|
- lib/m-spec/core/spec_example.rb
|
|
81
82
|
- lib/m-spec/core/spec_result.rb
|