specifier 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -5
- data/lib/specifier/cli.rb +3 -8
- data/lib/specifier/context.rb +5 -3
- data/lib/specifier/example.rb +2 -2
- data/lib/specifier/expectation.rb +3 -7
- data/lib/specifier/formatter/documentation.rb +4 -2
- data/lib/specifier/logger.rb +0 -12
- data/lib/specifier/version.rb +1 -1
- metadata +32 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce389cfea3d7b6da8cbc114ec2667c0206e46673474591fc281e828af4971aae
|
4
|
+
data.tar.gz: 58605667b4f6a4cdc1354c56582e9533f46fb6af2ee037ee12d8fd49346eaf3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ab399483fff009972c98e6aefb4b4cb8e083d22e37b29da3b4873f3cbb6bdaccd947017bc4efb1d2618b95940e5e4accbffa3960f88738f6c0f8225587aedeb
|
7
|
+
data.tar.gz: 46d70f55fd6c0c0db94bd2c007db2f1e86111e206cc50d84c8c786a3153007c58e351580a8a84684c98255e88a2fadc4a927d6805c79478a40711883edf0b35f
|
data/README.md
CHANGED
@@ -36,11 +36,15 @@ bundle exec specifier ./specs
|
|
36
36
|
|
37
37
|
## Status
|
38
38
|
|
39
|
-
[![
|
40
|
-
|
41
|
-
[![
|
42
|
-
[![
|
39
|
+
[![CircleCI](https://circleci.com/gh/ksylvest/specifier.svg?style=svg)](https://circleci.com/gh/ksylvest/specifier)
|
40
|
+
|
41
|
+
[![CodeClimate (Maintainability)](https://api.codeclimate.com/v1/badges/391d09bf5fb4a6be19e2/maintainability)](https://codeclimate.com/github/ksylvest/specifier/maintainability)
|
42
|
+
[![CodeClimate (Test Coverage)](https://api.codeclimate.com/v1/badges/391d09bf5fb4a6be19e2/test_coverage)](https://codeclimate.com/github/ksylvest/specifier/test_coverage)
|
43
|
+
|
44
|
+
[![Gemnasium](https://gemnasium.com/badges/github.com/ksylvest/specifier.svg)](https://gemnasium.com/github.com/ksylvest/specifier)
|
45
|
+
|
46
|
+
|
43
47
|
|
44
48
|
## Copyright
|
45
49
|
|
46
|
-
Copyright (c) 2016 -
|
50
|
+
Copyright (c) 2016 - 2018 Kevin Sylvestre. See LICENSE for details.
|
data/lib/specifier/cli.rb
CHANGED
@@ -14,15 +14,10 @@ module Specifier
|
|
14
14
|
config = Slop.parse(items) do |options|
|
15
15
|
options.banner = BANNER
|
16
16
|
|
17
|
-
options.on
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
options.on '-v', '--version', 'version' do
|
22
|
-
return version
|
23
|
-
end
|
17
|
+
options.on('-h', '--help', 'help') { return help(options) }
|
18
|
+
options.on('-v', '--version', 'version') { return version }
|
24
19
|
|
25
|
-
options.string
|
20
|
+
options.string('-f', '--formatter', 'formatter', default: Specifier::Formatter::DEFAULT)
|
26
21
|
end
|
27
22
|
|
28
23
|
run(config)
|
data/lib/specifier/context.rb
CHANGED
@@ -21,9 +21,11 @@ module Specifier
|
|
21
21
|
attr_accessor :description
|
22
22
|
|
23
23
|
def self.setup(description, parent = nil, &block)
|
24
|
-
context =
|
25
|
-
|
26
|
-
|
24
|
+
context = new(description, &block)
|
25
|
+
if parent
|
26
|
+
context.parent = parent
|
27
|
+
parent.children << context
|
28
|
+
end
|
27
29
|
context.instance_eval(&block)
|
28
30
|
context
|
29
31
|
end
|
data/lib/specifier/example.rb
CHANGED
@@ -24,8 +24,8 @@ module Specifier
|
|
24
24
|
def run(world)
|
25
25
|
world.instance_eval(&@block)
|
26
26
|
return Result.new(:pass)
|
27
|
-
rescue
|
28
|
-
return Result.new(:fail,
|
27
|
+
rescue StandardError => message
|
28
|
+
return Result.new(:fail, message)
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -1,17 +1,13 @@
|
|
1
1
|
module Specifier
|
2
|
-
|
3
2
|
# Configures an expectation (used for expect statements).
|
4
3
|
#
|
5
4
|
# Usage:
|
6
5
|
#
|
7
6
|
# expectation = Specifier::Expectation.new("today")
|
8
|
-
# expectation.to(matcher) # 'raises '
|
7
|
+
# expectation.to(matcher) # 'raises 'ToError'
|
9
8
|
#
|
10
9
|
class Expectation
|
11
|
-
class
|
12
|
-
def initialize(message)
|
13
|
-
@message = message
|
14
|
-
end
|
10
|
+
class MatcherError < StandardError
|
15
11
|
end
|
16
12
|
|
17
13
|
def initialize(value)
|
@@ -19,7 +15,7 @@ module Specifier
|
|
19
15
|
end
|
20
16
|
|
21
17
|
def to(matcher)
|
22
|
-
raise
|
18
|
+
raise MatcherError, matcher.message unless matcher.match?(@value)
|
23
19
|
end
|
24
20
|
end
|
25
21
|
end
|
@@ -14,6 +14,8 @@ module Specifier
|
|
14
14
|
class Documentation < Base
|
15
15
|
INDENTATION = ' '.freeze
|
16
16
|
NAME = 'documentation'.freeze
|
17
|
+
PASS = '[PASS]'.freeze
|
18
|
+
FAIL = '[FAIL]'.freeze
|
17
19
|
|
18
20
|
Formatter.formatters[NAME] = self
|
19
21
|
|
@@ -27,8 +29,8 @@ module Specifier
|
|
27
29
|
|
28
30
|
message =
|
29
31
|
case result.status
|
30
|
-
when :pass then Colorizer.passed(indent(example.description))
|
31
|
-
when :fail then Colorizer.failed(indent(example.description))
|
32
|
+
when :pass then Colorizer.passed(indent("#{PASS} #{example.description}"))
|
33
|
+
when :fail then Colorizer.failed(indent("#{FAIL} #{example.description}"))
|
32
34
|
end
|
33
35
|
|
34
36
|
@logger.log(message)
|
data/lib/specifier/logger.rb
CHANGED
@@ -7,18 +7,6 @@ module Specifier
|
|
7
7
|
# Specifier.logger.log("...")
|
8
8
|
#
|
9
9
|
class Logger
|
10
|
-
module Color
|
11
|
-
BLACK = 0
|
12
|
-
RED = 1
|
13
|
-
GREEN = 2
|
14
|
-
YELLOW = 3
|
15
|
-
end
|
16
|
-
|
17
|
-
module Formatting
|
18
|
-
DEFAULT = 0
|
19
|
-
BOLD = 1
|
20
|
-
ITALIC = 3
|
21
|
-
end
|
22
10
|
|
23
11
|
def initialize(stream = STDOUT)
|
24
12
|
@stream = stream
|
data/lib/specifier/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -80,6 +80,34 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec_junit_formatter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: simplecov
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +122,7 @@ dependencies:
|
|
94
122
|
- - ">="
|
95
123
|
- !ruby/object:Gem::Version
|
96
124
|
version: '0'
|
97
|
-
description:
|
125
|
+
description: This should probably never be used.
|
98
126
|
email:
|
99
127
|
- kevin@ksylvest.com
|
100
128
|
executables:
|
@@ -146,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
174
|
version: '0'
|
147
175
|
requirements: []
|
148
176
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.7.3
|
150
178
|
signing_key:
|
151
179
|
specification_version: 4
|
152
180
|
summary: A testing framework written for fun.
|