brutal 1.6.0.beta3 → 1.6.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/brutal/format/ruby.rb +13 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5f2da67e5897977c5661ebd110bf1d3e0a3a035fbccf189d134050c1658ac02
4
- data.tar.gz: 9f5a8c72b6907ff587a27a2c33d53f8bf0b5964b48559ed70f4ceb102639e815
3
+ metadata.gz: 0f39f334e466f02513f3458e0a3f20ac59a4a3d7bf76f1c0cb7bbe97128c4aae
4
+ data.tar.gz: 06ef4476162a2f4570107ee9c70a97320aeeb95ee8f2851e27d07dc7aed86fe3
5
5
  SHA512:
6
- metadata.gz: ae6d7e2f950c2b201d7b5bec76c079ffbfe949a8d0a9e9119190501031efdb597cacacef8d9874e9b40d84849d45d2ce620340cb6b12b318f0a3d4a55a18954a
7
- data.tar.gz: bfd031e10fc2798ac51765bc03728286fa44e3379ad0f09c2abd138376ac3f5b5bbcea8c05178d9854c1e470728de2f21113d8b1634a2096aef99e55f722de23
6
+ metadata.gz: 22c03d27d6ab4e183f2469121e502bc0ad17705f90788dcb7b949b983cf70ba6f2e5344fa5db5f17a77a5cf6b66ec8a5c543bc7baf330b853acff70a82f8fdb7
7
+ data.tar.gz: 0f65b683c466789227826090f31a0e1ef976bb0d83d73f99549862be928c8643af0b5fac82bf0572db17dc978bc1a666a5dd1b4bcfeb7be5274b836e380a26db
data/README.md CHANGED
@@ -38,7 +38,7 @@ It is therefore the responsibility of the developer to analyze the generated beh
38
38
  Add this line to your application's Gemfile:
39
39
 
40
40
  ```ruby
41
- gem "brutal", ">= 1.6.0.beta3", require: false
41
+ gem "brutal", ">= 1.6.0.beta4", require: false
42
42
  ```
43
43
 
44
44
  And then execute:
@@ -39,8 +39,8 @@ class Brutal
39
39
  # Initialize a new scaffold generator.
40
40
  def initialize(header, before, subject, after, footer, *actuals, **contexts)
41
41
  header = "# Brutal test suite" if header.empty?
42
- before = "# Starting an example" if before.empty?
43
- after = "# Finishing an example" if after.empty?
42
+ before = "# Starting a test" if before.empty?
43
+ after = "# Finishing a test" if after.empty?
44
44
  footer = "# End of the brutal test" if footer.empty?
45
45
 
46
46
  warn("Empty subject!") if subject.empty?
@@ -98,27 +98,32 @@ class Brutal
98
98
 
99
99
  def actual_codes
100
100
  combinations_values.map do |values|
101
+ string = before_code
102
+ eval(before_code) # rubocop:disable Security/Eval
103
+
101
104
  actual_str = format(inspect(subject), **attributes(*values))
102
- string = actual_code(actual_str)
105
+ string += actual_code(actual_str)
103
106
  actual = eval(actual_str) # rubocop:disable Security/Eval, Lint/UselessAssignment
104
107
 
105
108
  actuals.each do |actual_value|
106
109
  result_str = format(actual_value, subject: "actual")
107
- string += "raise if #{result_str} != #{eval(result_str).inspect}\n" # rubocop:disable Security/Eval
110
+ result = eval(result_str) # rubocop:disable Security/Eval
111
+ string += "raise if #{result_str} != #{result.inspect}\n"
108
112
  end
109
113
 
114
+ string += after_code
115
+ eval(after_code) # rubocop:disable Security/Eval
116
+
110
117
  string
111
118
  end
112
119
  end
113
120
 
114
121
  def actual_code(actual_str)
115
122
  <<~CODE
116
- #{before_code}
117
123
  actual = begin
118
124
  #{actual_str.gsub(/^/, INDENTATION)}
119
125
  end
120
126
 
121
- #{after_code}
122
127
  CODE
123
128
  end
124
129
 
@@ -131,11 +136,13 @@ class Brutal
131
136
  def before_code
132
137
  <<~CODE
133
138
  #{before.chomp}
139
+
134
140
  CODE
135
141
  end
136
142
 
137
143
  def after_code
138
144
  <<~CODE
145
+
139
146
  #{after.chomp}
140
147
  CODE
141
148
  end
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.6.0.beta3
4
+ version: 1.6.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-18 00:00:00.000000000 Z
11
+ date: 2022-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler