transpec 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/lib/transpec/version.rb +1 -1
- data/transpec.gemspec +4 -3
- metadata +3 -97
- data/spec/.rubocop.yml +0 -23
- data/spec/integration/configuration_modification_spec.rb +0 -186
- data/spec/integration/conversion_spec.rb +0 -145
- data/spec/spec_helper.rb +0 -52
- data/spec/support/cache_helper.rb +0 -62
- data/spec/support/file_helper.rb +0 -25
- data/spec/support/shared_context.rb +0 -84
- data/spec/transpec/cli_spec.rb +0 -341
- data/spec/transpec/commit_message_spec.rb +0 -81
- data/spec/transpec/config_spec.rb +0 -99
- data/spec/transpec/converter_spec.rb +0 -1374
- data/spec/transpec/directory_cloner_spec.rb +0 -74
- data/spec/transpec/dynamic_analyzer/rewriter_spec.rb +0 -143
- data/spec/transpec/dynamic_analyzer_spec.rb +0 -329
- data/spec/transpec/git_spec.rb +0 -151
- data/spec/transpec/option_parser_spec.rb +0 -275
- data/spec/transpec/processed_source_spec.rb +0 -93
- data/spec/transpec/project_spec.rb +0 -194
- data/spec/transpec/record_spec.rb +0 -128
- data/spec/transpec/report_spec.rb +0 -126
- data/spec/transpec/rspec_version_spec.rb +0 -129
- data/spec/transpec/spec_file_finder_spec.rb +0 -118
- data/spec/transpec/spec_suite_spec.rb +0 -108
- data/spec/transpec/static_context_inspector_spec.rb +0 -713
- data/spec/transpec/syntax/allow_spec.rb +0 -122
- data/spec/transpec/syntax/be_boolean_spec.rb +0 -176
- data/spec/transpec/syntax/be_close_spec.rb +0 -51
- data/spec/transpec/syntax/current_example_spec.rb +0 -319
- data/spec/transpec/syntax/double_spec.rb +0 -175
- data/spec/transpec/syntax/example_group_spec.rb +0 -716
- data/spec/transpec/syntax/example_spec.rb +0 -301
- data/spec/transpec/syntax/expect_spec.rb +0 -313
- data/spec/transpec/syntax/have_spec.rb +0 -1276
- data/spec/transpec/syntax/hook_spec.rb +0 -215
- data/spec/transpec/syntax/its_spec.rb +0 -448
- data/spec/transpec/syntax/matcher_definition_spec.rb +0 -59
- data/spec/transpec/syntax/method_stub_spec.rb +0 -1301
- data/spec/transpec/syntax/oneliner_should_spec.rb +0 -628
- data/spec/transpec/syntax/operator_spec.rb +0 -871
- data/spec/transpec/syntax/pending_spec.rb +0 -415
- data/spec/transpec/syntax/raise_error_spec.rb +0 -354
- data/spec/transpec/syntax/receive_spec.rb +0 -499
- data/spec/transpec/syntax/rspec_configure_spec.rb +0 -870
- data/spec/transpec/syntax/should_receive_spec.rb +0 -1108
- data/spec/transpec/syntax/should_spec.rb +0 -497
- data/spec/transpec/util_spec.rb +0 -115
- data/spec/transpec_spec.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 196cada3fc6e32784d3e5392042482f6fd229a3d
|
4
|
+
data.tar.gz: 5c20aff88c81968bf371fa3aeac09e75b5b29a04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e0632950453067d50237c5a5ce8fc1223271ac7009c53915c4d3bbc04cb32aea820d2f03e44e995e692ddec57804b2dd49e2d31f981fbe6f1eea1ab24d4118e
|
7
|
+
data.tar.gz: dcf97938424d1788764298694806e59e174abc29b5d5643c359d310a67dda70e5d039f2f2a63adf4389811765b742e3fb3ba73e1512f7b8fa199ea98ffdec58c
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## Development
|
4
4
|
|
5
|
+
## v3.0.1
|
6
|
+
|
7
|
+
* Exclude spec files from the gem package to lighten the package size.
|
8
|
+
|
5
9
|
## v3.0.0
|
6
10
|
|
7
11
|
* Check whether rspec-rails is used in the target project via `Gemfile.lock` when `-s/--skip-dynamic-analysis` option is specified. ([#88](https://github.com/yujinakayama/transpec/issues/88))
|
data/lib/transpec/version.rb
CHANGED
data/transpec.gemspec
CHANGED
@@ -10,14 +10,15 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ['Yuji Nakayama']
|
11
11
|
spec.email = ['nkymyj@gmail.com']
|
12
12
|
spec.summary = 'The RSpec syntax converter'
|
13
|
-
spec.description = 'Transpec converts your specs to the latest RSpec syntax '
|
13
|
+
spec.description = 'Transpec converts your specs to the latest RSpec syntax ' \
|
14
14
|
'with static and dynamic code analysis.'
|
15
15
|
spec.homepage = 'http://yujinakayama.me/transpec/'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
|
-
spec.files = `git ls-files`.split(
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |path|
|
19
|
+
path.match(%r{^(test|spec|features)/})
|
20
|
+
end
|
19
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
22
|
spec.require_paths = ['lib']
|
22
23
|
|
23
24
|
spec.required_ruby_version = '>= 1.9.3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transpec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -341,53 +341,6 @@ files:
|
|
341
341
|
- lib/transpec/syntax/should_receive.rb
|
342
342
|
- lib/transpec/util.rb
|
343
343
|
- lib/transpec/version.rb
|
344
|
-
- spec/.rubocop.yml
|
345
|
-
- spec/integration/configuration_modification_spec.rb
|
346
|
-
- spec/integration/conversion_spec.rb
|
347
|
-
- spec/spec_helper.rb
|
348
|
-
- spec/support/cache_helper.rb
|
349
|
-
- spec/support/file_helper.rb
|
350
|
-
- spec/support/shared_context.rb
|
351
|
-
- spec/transpec/cli_spec.rb
|
352
|
-
- spec/transpec/commit_message_spec.rb
|
353
|
-
- spec/transpec/config_spec.rb
|
354
|
-
- spec/transpec/converter_spec.rb
|
355
|
-
- spec/transpec/directory_cloner_spec.rb
|
356
|
-
- spec/transpec/dynamic_analyzer/rewriter_spec.rb
|
357
|
-
- spec/transpec/dynamic_analyzer_spec.rb
|
358
|
-
- spec/transpec/git_spec.rb
|
359
|
-
- spec/transpec/option_parser_spec.rb
|
360
|
-
- spec/transpec/processed_source_spec.rb
|
361
|
-
- spec/transpec/project_spec.rb
|
362
|
-
- spec/transpec/record_spec.rb
|
363
|
-
- spec/transpec/report_spec.rb
|
364
|
-
- spec/transpec/rspec_version_spec.rb
|
365
|
-
- spec/transpec/spec_file_finder_spec.rb
|
366
|
-
- spec/transpec/spec_suite_spec.rb
|
367
|
-
- spec/transpec/static_context_inspector_spec.rb
|
368
|
-
- spec/transpec/syntax/allow_spec.rb
|
369
|
-
- spec/transpec/syntax/be_boolean_spec.rb
|
370
|
-
- spec/transpec/syntax/be_close_spec.rb
|
371
|
-
- spec/transpec/syntax/current_example_spec.rb
|
372
|
-
- spec/transpec/syntax/double_spec.rb
|
373
|
-
- spec/transpec/syntax/example_group_spec.rb
|
374
|
-
- spec/transpec/syntax/example_spec.rb
|
375
|
-
- spec/transpec/syntax/expect_spec.rb
|
376
|
-
- spec/transpec/syntax/have_spec.rb
|
377
|
-
- spec/transpec/syntax/hook_spec.rb
|
378
|
-
- spec/transpec/syntax/its_spec.rb
|
379
|
-
- spec/transpec/syntax/matcher_definition_spec.rb
|
380
|
-
- spec/transpec/syntax/method_stub_spec.rb
|
381
|
-
- spec/transpec/syntax/oneliner_should_spec.rb
|
382
|
-
- spec/transpec/syntax/operator_spec.rb
|
383
|
-
- spec/transpec/syntax/pending_spec.rb
|
384
|
-
- spec/transpec/syntax/raise_error_spec.rb
|
385
|
-
- spec/transpec/syntax/receive_spec.rb
|
386
|
-
- spec/transpec/syntax/rspec_configure_spec.rb
|
387
|
-
- spec/transpec/syntax/should_receive_spec.rb
|
388
|
-
- spec/transpec/syntax/should_spec.rb
|
389
|
-
- spec/transpec/util_spec.rb
|
390
|
-
- spec/transpec_spec.rb
|
391
344
|
- tasks/ci/spec.rake
|
392
345
|
- tasks/demo.rake
|
393
346
|
- tasks/fixtures/mail/2.99.0/COMMIT_EDITMSG
|
@@ -424,52 +377,5 @@ rubygems_version: 2.4.3
|
|
424
377
|
signing_key:
|
425
378
|
specification_version: 4
|
426
379
|
summary: The RSpec syntax converter
|
427
|
-
test_files:
|
428
|
-
- spec/.rubocop.yml
|
429
|
-
- spec/integration/configuration_modification_spec.rb
|
430
|
-
- spec/integration/conversion_spec.rb
|
431
|
-
- spec/spec_helper.rb
|
432
|
-
- spec/support/cache_helper.rb
|
433
|
-
- spec/support/file_helper.rb
|
434
|
-
- spec/support/shared_context.rb
|
435
|
-
- spec/transpec/cli_spec.rb
|
436
|
-
- spec/transpec/commit_message_spec.rb
|
437
|
-
- spec/transpec/config_spec.rb
|
438
|
-
- spec/transpec/converter_spec.rb
|
439
|
-
- spec/transpec/directory_cloner_spec.rb
|
440
|
-
- spec/transpec/dynamic_analyzer/rewriter_spec.rb
|
441
|
-
- spec/transpec/dynamic_analyzer_spec.rb
|
442
|
-
- spec/transpec/git_spec.rb
|
443
|
-
- spec/transpec/option_parser_spec.rb
|
444
|
-
- spec/transpec/processed_source_spec.rb
|
445
|
-
- spec/transpec/project_spec.rb
|
446
|
-
- spec/transpec/record_spec.rb
|
447
|
-
- spec/transpec/report_spec.rb
|
448
|
-
- spec/transpec/rspec_version_spec.rb
|
449
|
-
- spec/transpec/spec_file_finder_spec.rb
|
450
|
-
- spec/transpec/spec_suite_spec.rb
|
451
|
-
- spec/transpec/static_context_inspector_spec.rb
|
452
|
-
- spec/transpec/syntax/allow_spec.rb
|
453
|
-
- spec/transpec/syntax/be_boolean_spec.rb
|
454
|
-
- spec/transpec/syntax/be_close_spec.rb
|
455
|
-
- spec/transpec/syntax/current_example_spec.rb
|
456
|
-
- spec/transpec/syntax/double_spec.rb
|
457
|
-
- spec/transpec/syntax/example_group_spec.rb
|
458
|
-
- spec/transpec/syntax/example_spec.rb
|
459
|
-
- spec/transpec/syntax/expect_spec.rb
|
460
|
-
- spec/transpec/syntax/have_spec.rb
|
461
|
-
- spec/transpec/syntax/hook_spec.rb
|
462
|
-
- spec/transpec/syntax/its_spec.rb
|
463
|
-
- spec/transpec/syntax/matcher_definition_spec.rb
|
464
|
-
- spec/transpec/syntax/method_stub_spec.rb
|
465
|
-
- spec/transpec/syntax/oneliner_should_spec.rb
|
466
|
-
- spec/transpec/syntax/operator_spec.rb
|
467
|
-
- spec/transpec/syntax/pending_spec.rb
|
468
|
-
- spec/transpec/syntax/raise_error_spec.rb
|
469
|
-
- spec/transpec/syntax/receive_spec.rb
|
470
|
-
- spec/transpec/syntax/rspec_configure_spec.rb
|
471
|
-
- spec/transpec/syntax/should_receive_spec.rb
|
472
|
-
- spec/transpec/syntax/should_spec.rb
|
473
|
-
- spec/transpec/util_spec.rb
|
474
|
-
- spec/transpec_spec.rb
|
380
|
+
test_files: []
|
475
381
|
has_rdoc:
|
data/spec/.rubocop.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
|
2
|
-
inherit_from: ../.rubocop.yml
|
3
|
-
|
4
|
-
# Avoid warning "Possibly useless use of == in void context"
|
5
|
-
# for `should ==`
|
6
|
-
Void:
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
# Lengthen for long descriptions.
|
10
|
-
LineLength:
|
11
|
-
Max: 120
|
12
|
-
|
13
|
-
# raise_error matcher always requires {} form block.
|
14
|
-
Blocks:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
# Sometimes block alignment does not suit RSpec syntax.
|
18
|
-
BlockAlignment:
|
19
|
-
Enabled: false
|
20
|
-
|
21
|
-
# Suppress offences for namespace classes only with #describe.
|
22
|
-
ClassLength:
|
23
|
-
Enabled: false
|
@@ -1,186 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'transpec/cli'
|
5
|
-
|
6
|
-
module Transpec
|
7
|
-
describe 'RSpec.configure modification' do
|
8
|
-
include FileHelper
|
9
|
-
include_context 'isolated environment'
|
10
|
-
|
11
|
-
let(:cli) do
|
12
|
-
DynamicAnalyzer.any_instance.stub(:silent?).and_return(true)
|
13
|
-
cli = CLI.new
|
14
|
-
cli.stub(:puts)
|
15
|
-
cli
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when there are multiple RSpec.configure in the spec suite' do
|
19
|
-
it 'adds new options only to the one that was run first' do
|
20
|
-
create_file('spec/spec_helper.rb', <<-END)
|
21
|
-
RSpec.configure do |config|
|
22
|
-
end
|
23
|
-
END
|
24
|
-
|
25
|
-
create_file('spec/unit/spec_helper.rb', <<-END)
|
26
|
-
require 'spec_helper'
|
27
|
-
|
28
|
-
RSpec.configure do |config|
|
29
|
-
end
|
30
|
-
END
|
31
|
-
|
32
|
-
create_file('spec/unit/unit_spec.rb', <<-END)
|
33
|
-
require 'unit/spec_helper'
|
34
|
-
|
35
|
-
describe 'example' do
|
36
|
-
it 'responds to #message' do
|
37
|
-
Object.any_instance.stub(:message) do |arg|
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
END
|
42
|
-
|
43
|
-
cli.project.stub(:rspec_version).and_return(RSpecVersion.new('2.99.0'))
|
44
|
-
cli.run([])
|
45
|
-
|
46
|
-
File.read('spec/spec_helper.rb').should == <<-END
|
47
|
-
RSpec.configure do |config|
|
48
|
-
config.mock_with :rspec do |mocks|
|
49
|
-
# In RSpec 3, `any_instance` implementation blocks will be yielded the receiving
|
50
|
-
# instance as the first block argument to allow the implementation block to use
|
51
|
-
# the state of the receiver.
|
52
|
-
# In RSpec 2.99, to maintain compatibility with RSpec 3 you need to either set
|
53
|
-
# this config option to `false` OR set this to `true` and update your
|
54
|
-
# `any_instance` implementation blocks to account for the first block argument
|
55
|
-
# being the receiving instance.
|
56
|
-
mocks.yield_receiver_to_any_instance_implementation_blocks = true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
END
|
60
|
-
|
61
|
-
File.read('spec/unit/spec_helper.rb').should == <<-END
|
62
|
-
require 'spec_helper'
|
63
|
-
|
64
|
-
RSpec.configure do |config|
|
65
|
-
end
|
66
|
-
END
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'converts deprecated options in all RSpec.configure' do
|
70
|
-
create_file('spec/spec_helper.rb', <<-END)
|
71
|
-
RSpec.configure do |config|
|
72
|
-
config.color_enabled = true
|
73
|
-
end
|
74
|
-
END
|
75
|
-
|
76
|
-
create_file('spec/unit/spec_helper.rb', <<-END)
|
77
|
-
require 'spec_helper'
|
78
|
-
|
79
|
-
RSpec.configure do |config|
|
80
|
-
config.color_enabled = true
|
81
|
-
end
|
82
|
-
END
|
83
|
-
|
84
|
-
create_file('spec/unit/unit_spec.rb', <<-END)
|
85
|
-
require 'unit/spec_helper'
|
86
|
-
|
87
|
-
describe 'example' do
|
88
|
-
it 'is true' do
|
89
|
-
expect(true).to be true
|
90
|
-
end
|
91
|
-
end
|
92
|
-
END
|
93
|
-
|
94
|
-
cli.run([])
|
95
|
-
|
96
|
-
File.read('spec/spec_helper.rb').should == <<-END
|
97
|
-
RSpec.configure do |config|
|
98
|
-
config.color = true
|
99
|
-
end
|
100
|
-
END
|
101
|
-
|
102
|
-
File.read('spec/unit/spec_helper.rb').should == <<-END
|
103
|
-
require 'spec_helper'
|
104
|
-
|
105
|
-
RSpec.configure do |config|
|
106
|
-
config.color = true
|
107
|
-
end
|
108
|
-
END
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe 'yield_receiver_to_any_instance_implementation_blocks' do
|
113
|
-
let(:spec_helper_path) { 'spec/spec_helper.rb' }
|
114
|
-
|
115
|
-
before do
|
116
|
-
create_file(spec_helper_path, <<-END)
|
117
|
-
RSpec.configure do |config|
|
118
|
-
end
|
119
|
-
END
|
120
|
-
end
|
121
|
-
|
122
|
-
[
|
123
|
-
'Object.any_instance.stub(:message)',
|
124
|
-
'Object.any_instance.should_receive(:message)',
|
125
|
-
'allow_any_instance_of(Object).to receive(:message)',
|
126
|
-
'expect_any_instance_of(Object).to receive(:message)'
|
127
|
-
].each do |syntax|
|
128
|
-
context "when there's a #{syntax} block to convert" do
|
129
|
-
before do
|
130
|
-
create_file('spec/example_spec.rb', <<-END)
|
131
|
-
describe 'example' do
|
132
|
-
it 'responds to #message' do
|
133
|
-
#{syntax} do |arg|
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
END
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'adds yield_receiver_to_any_instance_implementation_blocks to the RSpec.configure' do
|
141
|
-
cli.project.stub(:rspec_version).and_return(RSpecVersion.new('2.99.0'))
|
142
|
-
cli.run([])
|
143
|
-
|
144
|
-
File.read(spec_helper_path).should == <<-END
|
145
|
-
RSpec.configure do |config|
|
146
|
-
config.mock_with :rspec do |mocks|
|
147
|
-
# In RSpec 3, `any_instance` implementation blocks will be yielded the receiving
|
148
|
-
# instance as the first block argument to allow the implementation block to use
|
149
|
-
# the state of the receiver.
|
150
|
-
# In RSpec 2.99, to maintain compatibility with RSpec 3 you need to either set
|
151
|
-
# this config option to `false` OR set this to `true` and update your
|
152
|
-
# `any_instance` implementation blocks to account for the first block argument
|
153
|
-
# being the receiving instance.
|
154
|
-
mocks.yield_receiver_to_any_instance_implementation_blocks = true
|
155
|
-
end
|
156
|
-
end
|
157
|
-
END
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
context "when there's no any_instance blocks to convert" do
|
163
|
-
before do
|
164
|
-
create_file('spec/example_spec.rb', <<-END)
|
165
|
-
describe 'example' do
|
166
|
-
it 'responds to #foo' do
|
167
|
-
Object.any_instance.stub(:foo) do
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
END
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'does not modify RSpec.configure' do
|
175
|
-
cli.project.stub(:rspec_version).and_return(RSpecVersion.new('2.99.0'))
|
176
|
-
cli.run([])
|
177
|
-
|
178
|
-
File.read(spec_helper_path).should == <<-END
|
179
|
-
RSpec.configure do |config|
|
180
|
-
end
|
181
|
-
END
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'transpec/cli'
|
5
|
-
|
6
|
-
module Transpec
|
7
|
-
describe 'conversion' do
|
8
|
-
include FileHelper
|
9
|
-
include_context 'isolated environment'
|
10
|
-
|
11
|
-
let(:cli) do
|
12
|
-
DynamicAnalyzer.any_instance.stub(:silent?).and_return(true)
|
13
|
-
cli = CLI.new
|
14
|
-
cli.stub(:puts)
|
15
|
-
cli
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:spec_path) { 'spec/example_spec.rb' }
|
19
|
-
|
20
|
-
let(:converted_source) do
|
21
|
-
create_file(spec_path, source)
|
22
|
-
cli.run([])
|
23
|
-
File.read(spec_path)
|
24
|
-
end
|
25
|
-
|
26
|
-
describe 'one-liner expectation with have(n).items matcher' do
|
27
|
-
let(:source) do
|
28
|
-
<<-END
|
29
|
-
class Team
|
30
|
-
def players
|
31
|
-
[:foo, :bar, :baz]
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'example' do
|
36
|
-
describe 'collection' do
|
37
|
-
subject { [:foo, :bar, :baz] }
|
38
|
-
|
39
|
-
it { should have(3).items }
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'owner of collection' do
|
43
|
-
subject { Team.new }
|
44
|
-
|
45
|
-
it { should have_at_least(3).players }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
END
|
49
|
-
end
|
50
|
-
|
51
|
-
let(:expected_source) do
|
52
|
-
<<-END
|
53
|
-
class Team
|
54
|
-
def players
|
55
|
-
[:foo, :bar, :baz]
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'example' do
|
60
|
-
describe 'collection' do
|
61
|
-
subject { [:foo, :bar, :baz] }
|
62
|
-
|
63
|
-
it 'has 3 items' do
|
64
|
-
expect(subject.size).to eq(3)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe 'owner of collection' do
|
69
|
-
subject { Team.new }
|
70
|
-
|
71
|
-
it 'has at least 3 players' do
|
72
|
-
expect(subject.players.size).to be >= 3
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
END
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'is converted properly' do
|
80
|
-
converted_source.should == expected_source
|
81
|
-
end
|
82
|
-
|
83
|
-
context 'with #its' do
|
84
|
-
let(:source) do
|
85
|
-
<<-END
|
86
|
-
describe 'example' do
|
87
|
-
subject { 'foo' }
|
88
|
-
its(:chars) { should have(3).items }
|
89
|
-
end
|
90
|
-
END
|
91
|
-
end
|
92
|
-
|
93
|
-
let(:expected_source) do
|
94
|
-
<<-END
|
95
|
-
describe 'example' do
|
96
|
-
subject { 'foo' }
|
97
|
-
|
98
|
-
describe '#chars' do
|
99
|
-
subject { super().chars }
|
100
|
-
|
101
|
-
it 'has 3 items' do
|
102
|
-
expect(subject.size).to eq(3)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
END
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'is converted properly' do
|
110
|
-
converted_source.should == expected_source
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
describe 'one-liner expectation with operator matcher' do
|
116
|
-
context 'in RSpec 2.99.0.beta2 or later' do
|
117
|
-
before do
|
118
|
-
cli.project.stub(:rspec_version).and_return(RSpecVersion.new('2.99.0.beta2'))
|
119
|
-
end
|
120
|
-
|
121
|
-
let(:source) do
|
122
|
-
<<-END
|
123
|
-
describe 'example' do
|
124
|
-
subject { 1 }
|
125
|
-
it { should == 1 }
|
126
|
-
end
|
127
|
-
END
|
128
|
-
end
|
129
|
-
|
130
|
-
let(:expected_source) do
|
131
|
-
<<-END
|
132
|
-
describe 'example' do
|
133
|
-
subject { 1 }
|
134
|
-
it { is_expected.to eq(1) }
|
135
|
-
end
|
136
|
-
END
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'is converted properly' do
|
140
|
-
converted_source.should == expected_source
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|