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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7a28cb7092435d6e8d053a9c50e698f3665dfec31a300b51d40ac04c615978d
4
- data.tar.gz: 1707c8668e817ba5ea961a2c415e6a253e390d103973d0108215f4cf4b5af725
3
+ metadata.gz: 8c7d0976d2d56b7989f91253c752561a10d01ce12ba20b6a4fca377ea424c69a
4
+ data.tar.gz: a41df011c54a846f949238cc89ab9a021f5d86281f1f18566bcb5963782397e9
5
5
  SHA512:
6
- metadata.gz: b32c1c84e619f109120b6c83e10d050861618179cc55d11d5cf33ad2760275d934a7280247781b44970b0433ef8eed55afbbd3bc724b0e13f9afd0470a1a0008
7
- data.tar.gz: 71639f7f96fc5274c0a9eefa76da473c00d9819260987ad315273a301e3331c72b7113b3d3a7b3246a7bef3bd5ff0177147a17846afc2eae6f5f847a0842df73
6
+ metadata.gz: da313236dd4e1ab8078bac1267835b85303ba81129a5d469db198fd9fc65fae1f4decc0b0ad894878810bda3460feb4a84b76db637c4b1d1580457d48ea5e994
7
+ data.tar.gz: ee2e2c89b3eef006a17362d18987bdc31f5269804814c890ccb2597517f0a67cee1ab1c80c6a05b6268c87930d6c56fc7f624d0427cf6764e2d11956efb16cce
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.7.2 (2018-10-08)
6
+
7
+ - Add `RSpec/AggregateFailures` support for non-regular 'its' examples. ([@broels][])
8
+
5
9
  ## 0.7.1 (2018-08-20)
6
10
 
7
11
  - Add ability to ignore connection configurations in shared connection.([@palkan][])
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
- _method, _args, body = *node
142
- "#{base_indent}#{indent}#{body.source}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TestProf
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
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.1
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-20 00:00:00.000000000 Z
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.58.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.58.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.6
217
+ rubygems_version: 2.7.7
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: Ruby applications tests profiling tools