brutal 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/README.md +7 -7
- data/bin/brutal +1 -1
- data/lib/brutal.rb +1 -1
- data/lib/brutal/configuration.rb +7 -7
- data/lib/brutal/file/read.rb +1 -1
- data/lib/brutal/file/write.rb +2 -2
- data/lib/brutal/scaffold.rb +6 -6
- data/lib/brutal/yaml.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a7eb1b01e30dda0f5b204eef32ac2ec59c19384b37500f40587a1a522fce6db
|
4
|
+
data.tar.gz: be19e4c8f4741658ef2aea98891b8bf040a250361fe48fee5219b02cc297b10f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 565a5d6628dd7f3904f97343da33539eaddf97c6fa020d2c14736ed84a146c3fe3d0aa7eb6fdfc73a94a3238be3bba40d892f07281d231918022b2c96fb95ce6
|
7
|
+
data.tar.gz: 245f56b40a04d626c653e679b3634a5e1f3805a4f356c6f009759cb9e350e675b89e17e699e430fac5ffcb596e83c19190b929b4086b1da42254f2ffdbc7ea60
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# Brutal 💎🔨
|
2
2
|
|
3
3
|
[![RuboCop Status](https://github.com/fixrb/brutal/workflows/RuboCop/badge.svg)][workflow_rubocop]
|
4
|
-
[![Build Status](https://api.travis-ci.org/fixrb/brutal.svg?branch=
|
4
|
+
[![Build Status](https://api.travis-ci.org/fixrb/brutal.svg?branch=main)][travis]
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/brutal.svg)][gem]
|
6
|
-
[![Inline docs](https://inch-ci.org/github/fixrb/brutal.svg?branch=
|
6
|
+
[![Inline docs](https://inch-ci.org/github/fixrb/brutal.svg?branch=main)][inchpages]
|
7
7
|
[![Documentation](http://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
|
8
8
|
|
9
9
|
> A _code-first_ approach to automate the writing of unit tests.
|
10
10
|
|
11
11
|
## Intro
|
12
12
|
|
13
|
-
[![I Hate Tests](https://github.com/fixrb/brutal/raw/
|
13
|
+
[![I Hate Tests](https://github.com/fixrb/brutal/raw/main/img/rubyhack-2019-ruby3-what-s-missing-by-yukihiro-matsumoto.jpg)](https://www.youtube.com/embed/cmOt9HhszCI?start=1732&end=1736 "I don't like tests. It's not DRY.")
|
14
14
|
|
15
15
|
> I don't like tests. It's not DRY.<br/>
|
16
16
|
> -- [Matz](https://github.com/matz)
|
@@ -38,7 +38,7 @@ This is the price for _Brutal-Driven Development_.
|
|
38
38
|
Add this line to your application's Gemfile:
|
39
39
|
|
40
40
|
```ruby
|
41
|
-
gem
|
41
|
+
gem "brutal"
|
42
42
|
```
|
43
43
|
|
44
44
|
And then execute:
|
@@ -111,7 +111,7 @@ raise if actual.length != 9
|
|
111
111
|
|
112
112
|
### More examples
|
113
113
|
|
114
|
-
https://github.com/fixrb/brutal/raw/
|
114
|
+
https://github.com/fixrb/brutal/raw/main/examples/
|
115
115
|
|
116
116
|
## Rake integration example
|
117
117
|
|
@@ -119,7 +119,7 @@ A generated `test.rb` file could be matched as follows:
|
|
119
119
|
|
120
120
|
```ruby
|
121
121
|
Rake::TestTask.new do |t|
|
122
|
-
t.pattern =
|
122
|
+
t.pattern = "test.rb"
|
123
123
|
end
|
124
124
|
```
|
125
125
|
|
@@ -140,7 +140,7 @@ The [gem](https://rubygems.org/gems/brutal) is available as open source under th
|
|
140
140
|
<p>
|
141
141
|
This project is sponsored by:<br />
|
142
142
|
<a href="https://sashite.com/"><img
|
143
|
-
src="https://github.com/fixrb/brutal/raw/
|
143
|
+
src="https://github.com/fixrb/brutal/raw/main/img/sashite.png"
|
144
144
|
alt="Sashite" /></a>
|
145
145
|
</p>
|
146
146
|
|
data/bin/brutal
CHANGED
data/lib/brutal.rb
CHANGED
data/lib/brutal/configuration.rb
CHANGED
@@ -7,18 +7,18 @@ module Brutal
|
|
7
7
|
class Configuration
|
8
8
|
DEFAULT_ACTUALS = [].freeze
|
9
9
|
DEFAULT_CONTEXTS = {}.freeze
|
10
|
-
DEFAULT_HEAD =
|
11
|
-
DEFAULT_SUBJECT =
|
10
|
+
DEFAULT_HEAD = "# Brutal test suite"
|
11
|
+
DEFAULT_SUBJECT = ""
|
12
12
|
|
13
13
|
# Load the configuration parameters.
|
14
14
|
#
|
15
15
|
# @param params [Hash] Receive the 4 top-level section parameters.
|
16
16
|
def self.load(params)
|
17
17
|
new(
|
18
|
-
actuals:
|
19
|
-
contexts: params.fetch(
|
20
|
-
header:
|
21
|
-
subject:
|
18
|
+
actuals: params.fetch("actuals", DEFAULT_ACTUALS),
|
19
|
+
contexts: params.fetch("contexts", DEFAULT_CONTEXTS),
|
20
|
+
header: params.fetch("header", DEFAULT_HEAD),
|
21
|
+
subject: params.fetch("subject", DEFAULT_SUBJECT)
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
@@ -41,7 +41,7 @@ module Brutal
|
|
41
41
|
raise ::TypeError, header.inspect unless header.is_a?(::String)
|
42
42
|
raise ::TypeError, subject.inspect unless subject.is_a?(::String)
|
43
43
|
|
44
|
-
@actuals = actuals
|
44
|
+
@actuals = actuals.sort
|
45
45
|
@contexts = contexts
|
46
46
|
@header = header
|
47
47
|
@subject = subject
|
data/lib/brutal/file/read.rb
CHANGED
data/lib/brutal/file/write.rb
CHANGED
@@ -9,7 +9,7 @@ module Brutal
|
|
9
9
|
#
|
10
10
|
# @since 1.1.0
|
11
11
|
class Write
|
12
|
-
NAME =
|
12
|
+
NAME = "test.rb"
|
13
13
|
|
14
14
|
attr_reader :name
|
15
15
|
|
@@ -18,7 +18,7 @@ module Brutal
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def call(scaffold)
|
21
|
-
file = ::File.open(path,
|
21
|
+
file = ::File.open(path, "w")
|
22
22
|
file.write(scaffold)
|
23
23
|
|
24
24
|
true
|
data/lib/brutal/scaffold.rb
CHANGED
@@ -19,9 +19,9 @@ module Brutal
|
|
19
19
|
|
20
20
|
# Initialize a new scaffold generator.
|
21
21
|
def initialize(header, subject, *actuals, **contexts)
|
22
|
-
warn(
|
23
|
-
warn(
|
24
|
-
warn(
|
22
|
+
warn("Empty subject!") if subject.empty?
|
23
|
+
warn("Empty actual values!") if actuals.empty?
|
24
|
+
warn("Empty contexts!") if contexts.empty?
|
25
25
|
|
26
26
|
eval(header) # rubocop:disable Security/Eval
|
27
27
|
|
@@ -61,7 +61,7 @@ module Brutal
|
|
61
61
|
actual = eval(actual_str) # rubocop:disable Security/Eval, Lint/UselessAssignment
|
62
62
|
|
63
63
|
actuals.each do |actual_value|
|
64
|
-
result_str = format(actual_value, subject:
|
64
|
+
result_str = format(actual_value, subject: "actual")
|
65
65
|
string += "raise if #{result_str} != #{eval(result_str).inspect}\n" # rubocop:disable Security/Eval
|
66
66
|
end
|
67
67
|
|
@@ -71,8 +71,8 @@ module Brutal
|
|
71
71
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
72
72
|
|
73
73
|
def blank_line
|
74
|
-
"\n"
|
75
|
-
"# #{
|
74
|
+
"\n" \
|
75
|
+
"# #{'-' * 78}\n" \
|
76
76
|
"\n"
|
77
77
|
end
|
78
78
|
|
data/lib/brutal/yaml.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brutal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-md
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rubocop-performance
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,20 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rubocop-thread_safety
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
157
|
- !ruby/object:Gem::Version
|
130
158
|
version: '0'
|
131
159
|
requirements: []
|
132
|
-
rubygems_version: 3.1.
|
160
|
+
rubygems_version: 3.1.4
|
133
161
|
signing_key:
|
134
162
|
specification_version: 4
|
135
163
|
summary: A code-first approach to automate the writing of unit tests.
|