brutal 1.6.0.beta2 → 1.6.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a8a912485598e917360c280db92eee2b3acc53180dd0587b2147ea0eb26e649
4
- data.tar.gz: 5a7a1f13b748e8deb7d5a1529ca2e11eb35b687aabab84f7b9fc9ebc58d0b174
3
+ metadata.gz: 0f39f334e466f02513f3458e0a3f20ac59a4a3d7bf76f1c0cb7bbe97128c4aae
4
+ data.tar.gz: 06ef4476162a2f4570107ee9c70a97320aeeb95ee8f2851e27d07dc7aed86fe3
5
5
  SHA512:
6
- metadata.gz: ec1ffa0f11a17812ff0000bc7e8b4ba8a04c826e37f9ef5e777681312fcb87962020f034b4802b617471894019f9c046598a012eeb6491c6548f0fef233af66d
7
- data.tar.gz: 363647b4219053d2433fa198aac832b8f8f630e36d7b9282f0c36c34c2a255e5874ee91e481440be6bea2c87bb7763225ddbd04bfbf0204ad949bea98b5fbb01
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.beta2", require: false
41
+ gem "brutal", ">= 1.6.0.beta4", require: false
42
42
  ```
43
43
 
44
44
  And then execute:
@@ -7,8 +7,7 @@ require "pathname"
7
7
  class Brutal
8
8
  # Accept an arbitrary number of arguments passed from the command-line.
9
9
  class CommandLineArgumentsParser
10
- MANIFEST_FILENAME_SUFFIX = Manifest::File::Name::SUFFIX
11
- MANIFEST_FILENAME_PATTERN = ::File.join("**", "*#{MANIFEST_FILENAME_SUFFIX}")
10
+ MANIFEST_FILENAME_PATTERN = ::File.join("**", Manifest::File::Name::SUFFIX_PATTERN)
12
11
  CURRENT_DIRECTORY_CONTEXT = "."
13
12
  GEM_NAME = "brutal"
14
13
  HELP_OPTION = "--help"
@@ -83,7 +82,7 @@ class Brutal
83
82
  end
84
83
 
85
84
  def load_file!(pathname)
86
- if pathname.fnmatch?(MANIFEST_FILENAME_PATTERN)
85
+ if pathname.fnmatch?(MANIFEST_FILENAME_PATTERN, ::File::FNM_PATHNAME | ::File::FNM_DOTMATCH)
87
86
  @pathnames << pathname
88
87
  else
89
88
  warn "Skipping #{pathname} because not matched against #{MANIFEST_FILENAME_PATTERN}."
@@ -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
@@ -11,7 +11,9 @@ class Brutal
11
11
  attr_reader :yaml
12
12
 
13
13
  def initialize(pathname)
14
- raise ::ArgumentError unless pathname.fnmatch?(Name::SUFFIX_PATTERN)
14
+ unless pathname.fnmatch?(Name::SUFFIX_PATTERN, ::File::FNM_PATHNAME | ::File::FNM_DOTMATCH)
15
+ raise ::ArgumentError
16
+ end
15
17
 
16
18
  @yaml = pathname.read
17
19
  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.beta2
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