test-prof 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/test_prof/cops/rspec/aggregate_failures.rb +22 -3
- data/lib/test_prof/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c7d0976d2d56b7989f91253c752561a10d01ce12ba20b6a4fca377ea424c69a
|
4
|
+
data.tar.gz: a41df011c54a846f949238cc89ab9a021f5d86281f1f18566bcb5963782397e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da313236dd4e1ab8078bac1267835b85303ba81129a5d469db198fd9fc65fae1f4decc0b0ad894878810bda3460feb4a84b76db637c4b1d1580457d48ea5e994
|
7
|
+
data.tar.gz: ee2e2c89b3eef006a17362d18987bdc31f5269804814c890ccb2597517f0a67cee1ab1c80c6a05b6268c87930d6c56fc7f624d0427cf6764e2d11956efb16cce
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -45,6 +45,8 @@ Supported Ruby versions:
|
|
45
45
|
|
46
46
|
- [TestProf II: Factory therapy for your Ruby tests](https://evilmartians.com/chronicles/testprof-2-factory-therapy-for-your-ruby-tests-rspec-minitest)
|
47
47
|
|
48
|
+
- Paris.rb, 2018, "99 Problems of Slow Tests" talk [[video](https://www.youtube.com/watch?v=eDMZS_fkRtk), [slides](https://speakerdeck.com/palkan/paris-dot-rb-2018-99-problems-of-slow-tests)]
|
49
|
+
|
48
50
|
- RailsClub, Moscow, 2017, "Faster Tests" talk [[video](https://www.youtube.com/watch?v=8S7oHjEiVzs) (RU), [slides](https://speakerdeck.com/palkan/railsclub-moscow-2017-faster-tests)]
|
49
51
|
|
50
52
|
- RubyConfBy, 2017, "Run Test Run" talk [[video](https://www.youtube.com/watch?v=q52n4p0wkIs), [slides](https://speakerdeck.com/palkan/rubyconfby-minsk-2017-run-test-run)]
|
@@ -15,12 +15,14 @@ module RuboCop
|
|
15
15
|
# it { is_expected.to be_success }
|
16
16
|
# it { is_expected.to have_header('X-TOTAL-PAGES', 10) }
|
17
17
|
# it { is_expected.to have_header('X-NEXT-PAGE', 2) }
|
18
|
+
# its(:status) { is_expected.to eq(200) }
|
18
19
|
#
|
19
20
|
# # good
|
20
21
|
# it "returns the second page", :aggregate_failures do
|
21
22
|
# is_expected.to be_success
|
22
23
|
# is_expected.to have_header('X-TOTAL-PAGES', 10)
|
23
24
|
# is_expected.to have_header('X-NEXT-PAGE', 2)
|
25
|
+
# expect(subject.status).to eq(200)
|
24
26
|
# end
|
25
27
|
#
|
26
28
|
class AggregateFailures < RuboCop::Cop::Cop
|
@@ -30,7 +32,7 @@ module RuboCop
|
|
30
32
|
].freeze
|
31
33
|
|
32
34
|
EXAMPLE_BLOCKS = %i[
|
33
|
-
it specify example scenario
|
35
|
+
it its specify example scenario
|
34
36
|
].freeze
|
35
37
|
|
36
38
|
class << self
|
@@ -134,12 +136,29 @@ module RuboCop
|
|
134
136
|
def header_from(node)
|
135
137
|
method, _args, _body = *node
|
136
138
|
_receiver, method_name, _object = *method
|
139
|
+
method_name = :it if method_name == :its
|
137
140
|
%(#{method_name} "works", :aggregate_failures do)
|
138
141
|
end
|
139
142
|
|
140
143
|
def body_from(node, base_indent = '')
|
141
|
-
|
142
|
-
|
144
|
+
method, _args, body = *node
|
145
|
+
body_source = method.method_name == :its ? body_from_its(method, body) : body.source
|
146
|
+
"#{base_indent}#{indent}#{body_source}"
|
147
|
+
end
|
148
|
+
|
149
|
+
def body_from_its(method, body)
|
150
|
+
subject_attribute = method.arguments.first
|
151
|
+
expectation = body.method_name
|
152
|
+
match = body.arguments.first.source
|
153
|
+
|
154
|
+
if subject_attribute.array_type?
|
155
|
+
hash_keys = subject_attribute.values.map(&:value).join(", ")
|
156
|
+
attribute = "dig(#{hash_keys})"
|
157
|
+
else
|
158
|
+
attribute = subject_attribute.value
|
159
|
+
end
|
160
|
+
|
161
|
+
"expect(subject.#{attribute}).#{expectation} #{match}"
|
143
162
|
end
|
144
163
|
|
145
164
|
def indent
|
data/lib/test_prof/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08
|
11
|
+
date: 2018-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.59.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.59.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop-md
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.7.
|
217
|
+
rubygems_version: 2.7.7
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Ruby applications tests profiling tools
|