transpec 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -0
  3. data/CHANGELOG.md +4 -0
  4. data/lib/transpec/version.rb +1 -1
  5. data/transpec.gemspec +4 -3
  6. metadata +3 -97
  7. data/spec/.rubocop.yml +0 -23
  8. data/spec/integration/configuration_modification_spec.rb +0 -186
  9. data/spec/integration/conversion_spec.rb +0 -145
  10. data/spec/spec_helper.rb +0 -52
  11. data/spec/support/cache_helper.rb +0 -62
  12. data/spec/support/file_helper.rb +0 -25
  13. data/spec/support/shared_context.rb +0 -84
  14. data/spec/transpec/cli_spec.rb +0 -341
  15. data/spec/transpec/commit_message_spec.rb +0 -81
  16. data/spec/transpec/config_spec.rb +0 -99
  17. data/spec/transpec/converter_spec.rb +0 -1374
  18. data/spec/transpec/directory_cloner_spec.rb +0 -74
  19. data/spec/transpec/dynamic_analyzer/rewriter_spec.rb +0 -143
  20. data/spec/transpec/dynamic_analyzer_spec.rb +0 -329
  21. data/spec/transpec/git_spec.rb +0 -151
  22. data/spec/transpec/option_parser_spec.rb +0 -275
  23. data/spec/transpec/processed_source_spec.rb +0 -93
  24. data/spec/transpec/project_spec.rb +0 -194
  25. data/spec/transpec/record_spec.rb +0 -128
  26. data/spec/transpec/report_spec.rb +0 -126
  27. data/spec/transpec/rspec_version_spec.rb +0 -129
  28. data/spec/transpec/spec_file_finder_spec.rb +0 -118
  29. data/spec/transpec/spec_suite_spec.rb +0 -108
  30. data/spec/transpec/static_context_inspector_spec.rb +0 -713
  31. data/spec/transpec/syntax/allow_spec.rb +0 -122
  32. data/spec/transpec/syntax/be_boolean_spec.rb +0 -176
  33. data/spec/transpec/syntax/be_close_spec.rb +0 -51
  34. data/spec/transpec/syntax/current_example_spec.rb +0 -319
  35. data/spec/transpec/syntax/double_spec.rb +0 -175
  36. data/spec/transpec/syntax/example_group_spec.rb +0 -716
  37. data/spec/transpec/syntax/example_spec.rb +0 -301
  38. data/spec/transpec/syntax/expect_spec.rb +0 -313
  39. data/spec/transpec/syntax/have_spec.rb +0 -1276
  40. data/spec/transpec/syntax/hook_spec.rb +0 -215
  41. data/spec/transpec/syntax/its_spec.rb +0 -448
  42. data/spec/transpec/syntax/matcher_definition_spec.rb +0 -59
  43. data/spec/transpec/syntax/method_stub_spec.rb +0 -1301
  44. data/spec/transpec/syntax/oneliner_should_spec.rb +0 -628
  45. data/spec/transpec/syntax/operator_spec.rb +0 -871
  46. data/spec/transpec/syntax/pending_spec.rb +0 -415
  47. data/spec/transpec/syntax/raise_error_spec.rb +0 -354
  48. data/spec/transpec/syntax/receive_spec.rb +0 -499
  49. data/spec/transpec/syntax/rspec_configure_spec.rb +0 -870
  50. data/spec/transpec/syntax/should_receive_spec.rb +0 -1108
  51. data/spec/transpec/syntax/should_spec.rb +0 -497
  52. data/spec/transpec/util_spec.rb +0 -115
  53. data/spec/transpec_spec.rb +0 -22
@@ -1,301 +0,0 @@
1
- # coding: utf-8
2
-
3
- require 'spec_helper'
4
- require 'transpec/syntax/example'
5
- require 'ast'
6
-
7
- module Transpec
8
- class Syntax
9
- describe Example do
10
- include ::AST::Sexp
11
- include_context 'parsed objects'
12
- include_context 'syntax object', Example, :example_object
13
-
14
- let(:record) { example_object.report.records.last }
15
-
16
- describe '#conversion_target?' do
17
- let(:target_node) do
18
- ast.each_node(:send).find do |send_node|
19
- method_name = send_node.children[1]
20
- method_name == :pending
21
- end
22
- end
23
-
24
- let(:example_object) do
25
- Example.new(target_node, runtime_data)
26
- end
27
-
28
- subject { example_object.conversion_target? }
29
-
30
- context 'when #pending example node is passed' do
31
- let(:source) do
32
- <<-END
33
- describe 'example' do
34
- pending 'will be skipped' do
35
- end
36
- end
37
- END
38
- end
39
-
40
- context 'without runtime information' do
41
- it { should be_true }
42
- end
43
-
44
- context 'with runtime information' do
45
- include_context 'dynamic analysis objects'
46
- it { should be_true }
47
- end
48
- end
49
-
50
- context 'when #pending specification node inside of an example is passed' do
51
- let(:source) do
52
- <<-END
53
- describe 'example' do
54
- it 'will be skipped' do
55
- pending
56
- end
57
- end
58
- END
59
- end
60
-
61
- context 'without runtime information' do
62
- it { should be_false }
63
- end
64
-
65
- context 'with runtime information' do
66
- include_context 'dynamic analysis objects'
67
- it { should be_false }
68
- end
69
- end
70
- end
71
-
72
- describe '#metadata_key_nodes' do
73
- subject { example_object.metadata_key_nodes }
74
-
75
- context 'with expression `it { }`' do
76
- let(:source) do
77
- <<-END
78
- describe 'example' do
79
- it { do_something }
80
- end
81
- END
82
- end
83
-
84
- it 'returns empty array' do
85
- should be_empty
86
- end
87
- end
88
-
89
- context "with expression `it 'description' { }`" do
90
- let(:source) do
91
- <<-END
92
- describe 'example' do
93
- it 'is an example' do
94
- do_something
95
- end
96
- end
97
- END
98
- end
99
-
100
- it 'returns empty array' do
101
- should be_empty
102
- end
103
- end
104
-
105
- context "with expression `it 'description', :foo { }`" do
106
- let(:source) do
107
- <<-END
108
- describe 'example' do
109
- it 'is an example', :foo do
110
- do_something
111
- end
112
- end
113
- END
114
- end
115
-
116
- it 'returns [(sym :foo)]' do
117
- should == [s(:sym, :foo)]
118
- end
119
- end
120
-
121
- context "with expression `it 'description', foo: true { }`" do
122
- let(:source) do
123
- <<-END
124
- describe 'example' do
125
- it 'is an example', foo: true do
126
- do_something
127
- end
128
- end
129
- END
130
- end
131
-
132
- it 'returns [(sym :foo)]' do
133
- should == [s(:sym, :foo)]
134
- end
135
- end
136
-
137
- context "with expression `it 'description', :foo, :bar, baz: true { }`" do
138
- let(:source) do
139
- <<-END
140
- describe 'example' do
141
- it 'is an example', :foo, :bar, baz: true do
142
- do_something
143
- end
144
- end
145
- END
146
- end
147
-
148
- it 'returns [s(:sym, :foo), s(:sym, :bar), s(:sym, :baz)]' do
149
- should == [s(:sym, :foo), s(:sym, :bar), s(:sym, :baz)]
150
- end
151
- end
152
- end
153
-
154
- describe '#convert_pending_to_skip!' do
155
- before do
156
- example_object.convert_pending_to_skip!
157
- end
158
-
159
- context "with expression `pending 'is an example' { }`" do
160
- let(:source) do
161
- <<-END
162
- describe 'example' do
163
- pending 'will be skipped' do
164
- do_something
165
- end
166
- end
167
- END
168
- end
169
-
170
- let(:expected_source) do
171
- <<-END
172
- describe 'example' do
173
- skip 'will be skipped' do
174
- do_something
175
- end
176
- end
177
- END
178
- end
179
-
180
- it "converts to `skip 'is an example' { }` form" do
181
- rewritten_source.should == expected_source
182
- end
183
-
184
- it "adds record `pending 'is an example' { }` -> `skip 'is an example' { }`" do
185
- record.old_syntax.should == "pending 'is an example' { }"
186
- record.new_syntax.should == "skip 'is an example' { }"
187
- end
188
- end
189
-
190
- context "with expression `it 'is an example' { }`" do
191
- let(:source) do
192
- <<-END
193
- describe 'example' do
194
- it 'is normal example' do
195
- do_something
196
- end
197
- end
198
- END
199
- end
200
-
201
- it 'does nothing' do
202
- rewritten_source.should == source
203
- end
204
- end
205
-
206
- context "with expression `it 'is an example', :pending { }`" do
207
- let(:source) do
208
- <<-END
209
- describe 'example' do
210
- it 'will be skipped', :pending do
211
- do_something
212
- end
213
- end
214
- END
215
- end
216
-
217
- let(:expected_source) do
218
- <<-END
219
- describe 'example' do
220
- it 'will be skipped', :skip do
221
- do_something
222
- end
223
- end
224
- END
225
- end
226
-
227
- it "converts to `it 'is an example', :skip { }` form" do
228
- rewritten_source.should == expected_source
229
- end
230
-
231
- it "adds record `it 'is an example', :pending { }` -> `it 'is an example', :skip { }`" do
232
- record.old_syntax.should == "it 'is an example', :pending { }"
233
- record.new_syntax.should == "it 'is an example', :skip { }"
234
- end
235
- end
236
-
237
- context "with expression `it 'description', :pending => true { }`" do
238
- let(:source) do
239
- <<-END
240
- describe 'example' do
241
- it 'will be skipped', :pending => true do
242
- do_something
243
- end
244
- end
245
- END
246
- end
247
-
248
- let(:expected_source) do
249
- <<-END
250
- describe 'example' do
251
- it 'will be skipped', :skip => true do
252
- do_something
253
- end
254
- end
255
- END
256
- end
257
-
258
- it "converts to `it 'description', :skip => true { }` form" do
259
- rewritten_source.should == expected_source
260
- end
261
-
262
- it "adds record `it 'is an example', :pending => value { }` -> `it 'is an example', :skip => value { }`" do
263
- record.old_syntax.should == "it 'is an example', :pending => value { }"
264
- record.new_syntax.should == "it 'is an example', :skip => value { }"
265
- end
266
- end
267
-
268
- context "with expression `it 'description', pending: true { }`" do
269
- let(:source) do
270
- <<-END
271
- describe 'example' do
272
- it 'will be skipped', pending: true do
273
- do_something
274
- end
275
- end
276
- END
277
- end
278
-
279
- let(:expected_source) do
280
- <<-END
281
- describe 'example' do
282
- it 'will be skipped', skip: true do
283
- do_something
284
- end
285
- end
286
- END
287
- end
288
-
289
- it "converts to `it 'description', skip: true { }` form" do
290
- rewritten_source.should == expected_source
291
- end
292
-
293
- it "adds record `it 'is an example', :pending => value { }` -> `it 'is an example', :skip => value { }`" do
294
- record.old_syntax.should == "it 'is an example', :pending => value { }"
295
- record.new_syntax.should == "it 'is an example', :skip => value { }"
296
- end
297
- end
298
- end
299
- end
300
- end
301
- end
@@ -1,313 +0,0 @@
1
- # coding: utf-8
2
-
3
- require 'spec_helper'
4
- require 'transpec/syntax/expect'
5
-
6
- module Transpec
7
- class Syntax
8
- describe Expect do
9
- include_context 'parsed objects'
10
- include_context 'syntax object', Expect, :expect_object
11
-
12
- describe '#conversion_target?' do
13
- let(:target_node) do
14
- ast.each_node(:send).find do |send_node|
15
- method_name = send_node.children[1]
16
- method_name == :expect
17
- end
18
- end
19
-
20
- let(:expect_object) do
21
- Expect.new(target_node)
22
- end
23
-
24
- subject { expect_object.conversion_target? }
25
-
26
- context 'when the #expect node is chained by #to' do
27
- context 'and taking a matcher properly' do
28
- let(:source) do
29
- <<-END
30
- describe 'example' do
31
- it 'is valid expectation' do
32
- expect(obj).to matcher
33
- end
34
- end
35
- END
36
- end
37
-
38
- it { should be_true }
39
- end
40
-
41
- context 'but taking no matcher' do
42
- let(:source) do
43
- <<-END
44
- describe 'example' do
45
- it 'is invalid expectation' do
46
- expect(obj).to
47
- end
48
- end
49
- END
50
- end
51
-
52
- it { should be_false }
53
- end
54
- end
55
-
56
- context 'when the #expect node is chained by #not_to' do
57
- let(:source) do
58
- <<-END
59
- describe 'example' do
60
- it 'is valid expectation' do
61
- expect(obj).not_to matcher
62
- end
63
- end
64
- END
65
- end
66
-
67
- it { should be_true }
68
- end
69
-
70
- context 'when the #expect node is not chained' do
71
- let(:source) do
72
- <<-END
73
- describe 'example' do
74
- it 'is invalid expectation' do
75
- expect(obj)
76
- end
77
- end
78
- END
79
- end
80
-
81
- it { should be_false }
82
- end
83
-
84
- context 'when the #expect node is not chained and taken as a argument by another method' do
85
- let(:source) do
86
- <<-END
87
- describe 'example' do
88
- it 'is invalid expectation' do
89
- do_something(expect(obj))
90
- end
91
- end
92
- END
93
- end
94
-
95
- it { should be_false }
96
- end
97
- end
98
-
99
- describe '#subject_node' do
100
- context 'when the subject is a normal argument' do
101
- let(:source) do
102
- <<-END
103
- describe 'example' do
104
- it 'is empty' do
105
- expect(subject).to be_empty
106
- end
107
- end
108
- END
109
- end
110
-
111
- it 'returns the subject node' do
112
- method_name = expect_object.subject_node.children[1]
113
- method_name.should == :subject
114
- end
115
- end
116
-
117
- context 'when the subject is a block' do
118
- let(:source) do
119
- <<-END
120
- describe 'example' do
121
- it 'raises error' do
122
- expect { do_something }.to raise_error
123
- end
124
- end
125
- END
126
- end
127
-
128
- it 'returns the block node' do
129
- expect_object.subject_node.should be_block_type
130
- end
131
- end
132
- end
133
-
134
- describe '#to_node' do
135
- context 'when the subject is a normal argument' do
136
- let(:source) do
137
- <<-END
138
- describe 'example' do
139
- it 'is empty' do
140
- expect(subject).to be_empty
141
- end
142
- end
143
- END
144
- end
145
-
146
- it 'returns #to node' do
147
- method_name = expect_object.to_node.children[1]
148
- method_name.should == :to
149
- end
150
- end
151
-
152
- context 'when the subject is a block' do
153
- let(:source) do
154
- <<-END
155
- describe 'example' do
156
- it 'raises error' do
157
- expect { do_something }.to raise_error
158
- end
159
- end
160
- END
161
- end
162
-
163
- it 'returns #to node' do
164
- method_name = expect_object.to_node.children[1]
165
- method_name.should == :to
166
- end
167
- end
168
- end
169
-
170
- describe '#matcher_node' do
171
- let(:matcher_name) { expect_object.matcher_node.children[1] }
172
-
173
- context 'when the matcher is not taking a block' do
174
- let(:source) do
175
- <<-END
176
- describe 'example' do
177
- it 'is empty' do
178
- expect(subject).to be_empty
179
- end
180
- end
181
- END
182
- end
183
-
184
- it 'returns send node of the matcher' do
185
- matcher_name.should == :be_empty
186
- end
187
- end
188
-
189
- context 'when the matcher is taking a block' do
190
- let(:source) do
191
- <<-END
192
- describe 'example' do
193
- it 'receives :foo' do
194
- expect(subject).to receive(:foo) { }
195
- end
196
- end
197
- END
198
- end
199
-
200
- it 'returns send node of the matcher' do
201
- matcher_name.should == :receive
202
- end
203
- end
204
-
205
- context 'when the matcher is chained by another method' do
206
- let(:source) do
207
- <<-END
208
- describe 'example' do
209
- it 'receives :foo twice' do
210
- expect(subject).to receive(:foo).twice
211
- end
212
- end
213
- END
214
- end
215
-
216
- it 'returns the first node of the chain' do
217
- matcher_name.should == :receive
218
- end
219
- end
220
-
221
- context 'when the matcher is chained by another method that is taking a block' do
222
- let(:source) do
223
- <<-END
224
- describe 'example' do
225
- it 'receives :foo twice' do
226
- expect(subject).to receive(:foo).twice { }
227
- end
228
- end
229
- END
230
- end
231
-
232
- it 'returns the first node of the chain' do
233
- matcher_name.should == :receive
234
- end
235
- end
236
- end
237
-
238
- describe '#have_matcher' do
239
- subject { expect_object.have_matcher }
240
-
241
- let(:source) do
242
- <<-END
243
- describe 'example' do
244
- it 'has 2 items' do
245
- expect(subject).to have(2).items
246
- end
247
- end
248
- END
249
- end
250
-
251
- it 'returns an instance of Have' do
252
- should be_an(Have)
253
- end
254
- end
255
-
256
- describe '#receive_matcher' do
257
- subject { expect_object.receive_matcher }
258
-
259
- let(:source) do
260
- <<-END
261
- describe 'example' do
262
- it 'receives :foo' do
263
- expect(subject).to receive(:foo)
264
- end
265
- end
266
- END
267
- end
268
-
269
- it 'returns an instance of Receive' do
270
- should be_an(Receive)
271
- end
272
- end
273
-
274
- describe '#block_node' do
275
- subject { expect_object.block_node }
276
-
277
- context 'when the #to is taking a block' do
278
- let(:source) do
279
- <<-END
280
- describe 'example' do
281
- it 'receives :foo' do
282
- expect(subject).to receive(:foo) do |arg|
283
- end
284
- end
285
- end
286
- END
287
- end
288
-
289
- it 'returns the block node' do
290
- should be_block_type
291
- end
292
- end
293
-
294
- context 'when the #to is not taking a block' do
295
- let(:source) do
296
- <<-END
297
- describe 'example' do
298
- it 'receives :foo' do
299
- expect(subject).to receive(:foo) { |arg|
300
- }
301
- end
302
- end
303
- END
304
- end
305
-
306
- it 'returns nil' do
307
- should be_nil
308
- end
309
- end
310
- end
311
- end
312
- end
313
- end