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.
- 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
data/spec/spec_helper.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
RSpec.configure do |config|
|
4
|
-
unless ENV['TRANSPEC_TEST']
|
5
|
-
# Yes, I'm writing specs in should syntax intentionally!
|
6
|
-
config.expect_with :rspec do |c|
|
7
|
-
c.syntax = :should
|
8
|
-
end
|
9
|
-
|
10
|
-
config.mock_with :rspec do |c|
|
11
|
-
c.syntax = :should
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
config.color_enabled = true
|
16
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
17
|
-
|
18
|
-
# These two settings work together to allow you to limit a spec run
|
19
|
-
# to individual examples or groups you care about by tagging them with
|
20
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
21
|
-
# get run.
|
22
|
-
config.filter_run :focus
|
23
|
-
config.run_all_when_everything_filtered = true
|
24
|
-
|
25
|
-
config.before(:suite) do
|
26
|
-
require 'rainbow'
|
27
|
-
Rainbow.enabled = false
|
28
|
-
|
29
|
-
if ENV['TRAVIS']
|
30
|
-
system('git config --global user.email "you@example.com"')
|
31
|
-
system('git config --global user.name "Your Name"')
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
if ENV['TRAVIS'] || ENV['COVERAGE']
|
37
|
-
require 'simplecov'
|
38
|
-
|
39
|
-
if ENV['TRAVIS']
|
40
|
-
require 'coveralls'
|
41
|
-
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
42
|
-
end
|
43
|
-
|
44
|
-
SimpleCov.start do
|
45
|
-
add_filter '/spec/'
|
46
|
-
add_filter '/vendor/bundle/'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
Dir[File.join(File.dirname(__FILE__), 'support', '*')].each do |path|
|
51
|
-
require path
|
52
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'digest/sha1'
|
4
|
-
|
5
|
-
module CacheHelper
|
6
|
-
module_function
|
7
|
-
|
8
|
-
def with_cache(key)
|
9
|
-
cache_file_path = cache_file_path(key)
|
10
|
-
|
11
|
-
if File.exist?(cache_file_path)
|
12
|
-
load_cache(cache_file_path)
|
13
|
-
else
|
14
|
-
data = yield
|
15
|
-
save_cache(cache_file_path, data)
|
16
|
-
data
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def with_cached_dir(dirname)
|
21
|
-
dir_path = File.join(cache_dir, dirname)
|
22
|
-
|
23
|
-
cached = Dir.exist?(dir_path)
|
24
|
-
FileUtils.mkdir_p(dir_path) unless cached
|
25
|
-
|
26
|
-
Dir.chdir(dir_path) do
|
27
|
-
yield cached
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def load_cache(path)
|
32
|
-
File.open(path) do |file|
|
33
|
-
Marshal.load(file)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def save_cache(path, data)
|
38
|
-
File.open(path, 'w') do |file|
|
39
|
-
Marshal.dump(data, file)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def cache_file_path(key)
|
44
|
-
filename = Digest::SHA1.hexdigest(key)
|
45
|
-
File.join(cache_dir, filename)
|
46
|
-
end
|
47
|
-
|
48
|
-
def cache_dir
|
49
|
-
@cache_dir ||= begin
|
50
|
-
project_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
51
|
-
ruby_version = [RUBY_ENGINE, RUBY_VERSION].join('-')
|
52
|
-
cache_dir = File.join(project_root, '.cache', 'spec', ruby_version)
|
53
|
-
|
54
|
-
unless Dir.exist?(cache_dir)
|
55
|
-
require 'fileutils'
|
56
|
-
FileUtils.mkdir_p(cache_dir)
|
57
|
-
end
|
58
|
-
|
59
|
-
cache_dir
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/spec/support/file_helper.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module FileHelper
|
6
|
-
module_function
|
7
|
-
|
8
|
-
def create_file(file_path, content)
|
9
|
-
file_path = File.expand_path(file_path)
|
10
|
-
|
11
|
-
dir_path = File.dirname(file_path)
|
12
|
-
FileUtils.makedirs(dir_path) unless File.exist?(dir_path)
|
13
|
-
|
14
|
-
File.open(file_path, 'w') do |file|
|
15
|
-
case content
|
16
|
-
when String
|
17
|
-
file.puts content
|
18
|
-
when Array
|
19
|
-
file.puts content.join("\n")
|
20
|
-
else
|
21
|
-
fail 'Unsupported type!'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
# This context requires `source` to be defined with #let.
|
4
|
-
shared_context 'parsed objects' do
|
5
|
-
let(:source_path) { nil }
|
6
|
-
|
7
|
-
let(:processed_source) do
|
8
|
-
require 'transpec/processed_source'
|
9
|
-
Transpec::ProcessedSource.new(source, source_path)
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:ast) do
|
13
|
-
processed_source.ast
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:source_rewriter) do
|
17
|
-
require 'parser'
|
18
|
-
Parser::Source::Rewriter.new(processed_source.buffer)
|
19
|
-
end
|
20
|
-
|
21
|
-
let(:rewritten_source) { source_rewriter.process }
|
22
|
-
|
23
|
-
# Include 'dynamic analysis objects' after this context so that this nil will be overridden.
|
24
|
-
let(:runtime_data) { nil }
|
25
|
-
|
26
|
-
let(:project) do
|
27
|
-
require 'transpec/project'
|
28
|
-
Transpec::Project.new
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# This context requires `source` to be defined with #let.
|
33
|
-
shared_context 'dynamic analysis objects' do
|
34
|
-
include_context 'isolated environment'
|
35
|
-
|
36
|
-
let(:source_path) { 'spec/example_spec.rb' }
|
37
|
-
|
38
|
-
runtime_data_cache = {}
|
39
|
-
|
40
|
-
let(:runtime_data) do
|
41
|
-
require 'transpec/dynamic_analyzer'
|
42
|
-
|
43
|
-
if runtime_data_cache[source]
|
44
|
-
runtime_data_cache[source]
|
45
|
-
else
|
46
|
-
FileHelper.create_file(source_path, source)
|
47
|
-
dynamic_analyzer = Transpec::DynamicAnalyzer.new(silent: true)
|
48
|
-
runtime_data_cache[source] = dynamic_analyzer.analyze
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# This context depends on the context 'parsed objects'.
|
54
|
-
shared_context 'syntax object' do |syntax_class, name|
|
55
|
-
let(name) do
|
56
|
-
ast.each_node do |node|
|
57
|
-
syntax = syntax_class.new(node, runtime_data, project, source_rewriter)
|
58
|
-
return syntax if syntax.conversion_target?
|
59
|
-
end
|
60
|
-
|
61
|
-
fail "No #{syntax_class.name} conversion target is found!"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
shared_context 'isolated environment' do
|
66
|
-
around do |example|
|
67
|
-
require 'tmpdir'
|
68
|
-
Dir.mktmpdir do |tmpdir|
|
69
|
-
Dir.chdir(tmpdir) do
|
70
|
-
example.run
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
shared_context 'inside of git repository' do
|
77
|
-
around do |example|
|
78
|
-
Dir.mkdir('repo')
|
79
|
-
Dir.chdir('repo') do
|
80
|
-
`git init`
|
81
|
-
example.run
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
data/spec/transpec/cli_spec.rb
DELETED
@@ -1,341 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'transpec/cli'
|
5
|
-
|
6
|
-
module Transpec
|
7
|
-
describe CLI do
|
8
|
-
include FileHelper
|
9
|
-
|
10
|
-
subject(:cli) { CLI.new }
|
11
|
-
|
12
|
-
before do
|
13
|
-
cli.project.stub(:rspec_version).and_return(Transpec.required_rspec_version)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '.run' do
|
17
|
-
it 'invokes #run' do
|
18
|
-
args = ['foo', 'bar']
|
19
|
-
CLI.any_instance.should_receive(:run).with(args)
|
20
|
-
CLI.run(args)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#run' do
|
25
|
-
include_context 'isolated environment'
|
26
|
-
|
27
|
-
subject { cli.run(args) }
|
28
|
-
|
29
|
-
let(:args) { [file_path] }
|
30
|
-
let(:file_path) { 'spec/example_spec.rb' }
|
31
|
-
let(:file_content) do
|
32
|
-
<<-END
|
33
|
-
describe 'something' do
|
34
|
-
it 'is 1' do
|
35
|
-
1.should == 1
|
36
|
-
end
|
37
|
-
end
|
38
|
-
END
|
39
|
-
end
|
40
|
-
|
41
|
-
before do
|
42
|
-
cli.stub(:puts)
|
43
|
-
cli.stub(:warn)
|
44
|
-
DynamicAnalyzer.any_instance.stub(:analyze).and_return(DynamicAnalyzer::RuntimeData.new)
|
45
|
-
create_file(file_path, file_content)
|
46
|
-
end
|
47
|
-
|
48
|
-
shared_examples 'rewrites files' do
|
49
|
-
it 'rewrites files' do
|
50
|
-
cli.should_receive(:convert_spec)
|
51
|
-
cli.run(args)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'returns true' do
|
55
|
-
should be_true
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
shared_examples 'aborts processing' do
|
60
|
-
it 'aborts processing' do
|
61
|
-
cli.should_not_receive(:convert_spec)
|
62
|
-
cli.run(args).should be_false
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
shared_examples 'generates commit message' do
|
67
|
-
it 'generates commit message to .git/COMMIT_EDITMSG' do
|
68
|
-
cli.run(args)
|
69
|
-
File.read('.git/COMMIT_EDITMSG').should start_with('Convert specs')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
shared_examples 'does not generate commit message' do
|
74
|
-
it 'does not generate commit message' do
|
75
|
-
cli.run(args)
|
76
|
-
File.exist?('.git/COMMIT_EDITMSG').should be_false
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'when git is available' do
|
81
|
-
before { Git.stub(:command_available?).and_return(true) }
|
82
|
-
|
83
|
-
context 'and inside of a repository' do
|
84
|
-
include_context 'inside of git repository'
|
85
|
-
|
86
|
-
context 'and the repository is not clean' do
|
87
|
-
before { Git.stub(:clean?).and_return(false) }
|
88
|
-
|
89
|
-
context 'and --force option is not specified' do
|
90
|
-
include_examples 'aborts processing'
|
91
|
-
include_examples 'does not generate commit message'
|
92
|
-
|
93
|
-
it 'warns and suggests the use of -f/--force option' do
|
94
|
-
cli.should_receive(:warn) do |message|
|
95
|
-
message.should include('clean')
|
96
|
-
message.should include('-f/--force')
|
97
|
-
end
|
98
|
-
|
99
|
-
cli.run(args)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'and --force option is specified' do
|
104
|
-
before { args << '--force' }
|
105
|
-
include_examples 'rewrites files'
|
106
|
-
include_examples 'generates commit message'
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'and the repository is clean' do
|
111
|
-
before { Git.stub(:clean?).and_return(true) }
|
112
|
-
|
113
|
-
include_examples 'rewrites files'
|
114
|
-
include_examples 'generates commit message'
|
115
|
-
|
116
|
-
context 'and no conversion is done' do
|
117
|
-
let(:file_content) { '' }
|
118
|
-
include_examples 'does not generate commit message'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
context 'and not inside of a repository' do
|
124
|
-
include_examples 'rewrites files'
|
125
|
-
include_examples 'does not generate commit message'
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
context 'when git is not available' do
|
130
|
-
before { Git.stub(:command_available?).and_return(false) }
|
131
|
-
include_examples 'rewrites files'
|
132
|
-
include_examples 'does not generate commit message'
|
133
|
-
end
|
134
|
-
|
135
|
-
context "when the project's RSpec dependency is older than the required version" do
|
136
|
-
before do
|
137
|
-
cli.project.stub(:rspec_version).and_return(RSpecVersion.new('2.13.0'))
|
138
|
-
end
|
139
|
-
|
140
|
-
include_examples 'aborts processing'
|
141
|
-
|
142
|
-
it 'warns to the version' do
|
143
|
-
cli.should_receive(:warn).with(/rspec.+dependency/i)
|
144
|
-
cli.run(args)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'when analysis error is raised in the dynamic analysis' do
|
149
|
-
before do
|
150
|
-
DynamicAnalyzer.any_instance.stub(:analyze).and_raise(DynamicAnalyzer::AnalysisError)
|
151
|
-
end
|
152
|
-
|
153
|
-
include_examples 'aborts processing'
|
154
|
-
end
|
155
|
-
|
156
|
-
context 'when a syntax error is raised while processing files' do
|
157
|
-
let(:args) { [invalid_syntax_file_path, valid_syntax_file_path] }
|
158
|
-
let(:invalid_syntax_file_path) { 'spec/invalid_example.rb' }
|
159
|
-
let(:valid_syntax_file_path) { 'spec/valid_example.rb' }
|
160
|
-
|
161
|
-
before do
|
162
|
-
create_file(invalid_syntax_file_path, 'This is invalid syntax <')
|
163
|
-
create_file(valid_syntax_file_path, 'this_is_valid_syntax')
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'warns to the user' do
|
167
|
-
cli.should_receive(:warn)
|
168
|
-
.with('Syntax error at spec/invalid_example.rb:2:1. Skipping the file.')
|
169
|
-
cli.run(args)
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'continues processing files' do
|
173
|
-
cli.should_receive(:puts).with("Converting #{invalid_syntax_file_path}")
|
174
|
-
cli.should_receive(:puts).with("Converting #{valid_syntax_file_path}")
|
175
|
-
cli.run(args)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
context 'when an encoding error is raised while processing files' do
|
180
|
-
let(:args) { [invalid_encoding_file_path, valid_encoding_file_path] }
|
181
|
-
let(:invalid_encoding_file_path) { 'spec/invalid_example.rb' }
|
182
|
-
let(:valid_encoding_file_path) { 'spec/valid_example.rb' }
|
183
|
-
|
184
|
-
before do
|
185
|
-
create_file(invalid_encoding_file_path, <<-END)
|
186
|
-
# coding: utf-8
|
187
|
-
\xff
|
188
|
-
END
|
189
|
-
|
190
|
-
create_file(valid_encoding_file_path, 'this_is_valid_encoding')
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'warns of the error' do
|
194
|
-
cli.should_receive(:warn)
|
195
|
-
.with('Encoding error in spec/invalid_example.rb. Skipping the file.')
|
196
|
-
cli.run(args)
|
197
|
-
end
|
198
|
-
|
199
|
-
it 'continues processing files' do
|
200
|
-
cli.should_receive(:puts).with("Converting #{invalid_encoding_file_path}")
|
201
|
-
cli.should_receive(:puts).with("Converting #{valid_encoding_file_path}")
|
202
|
-
cli.run(args)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
context 'when any other error is raised while running' do
|
207
|
-
let(:args) { ['non-existent-file'] }
|
208
|
-
|
209
|
-
it 'does not catch the error' do
|
210
|
-
-> { cli.run(args) }.should raise_error
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
context 'when -s/--skip-dynamic-analysis option is specified' do
|
215
|
-
let(:args) { ['--skip-dynamic-analysis', file_path] }
|
216
|
-
|
217
|
-
it 'skips dynamic analysis' do
|
218
|
-
DynamicAnalyzer.any_instance.should_not_receive(:analyze)
|
219
|
-
cli.should_receive(:convert_spec)
|
220
|
-
cli.run(args)
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
context 'when -c/--rspec-command option is specified' do
|
225
|
-
include_context 'inside of git repository'
|
226
|
-
|
227
|
-
let(:args) { ['--force', '--rspec-command', 'rspec --profile'] }
|
228
|
-
|
229
|
-
it 'passes the command to DynamicAnalyzer' do
|
230
|
-
DynamicAnalyzer.should_receive(:new) do |arg|
|
231
|
-
arg[:rspec_command].should == 'rspec --profile'
|
232
|
-
end.and_call_original
|
233
|
-
|
234
|
-
cli.run(args)
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
describe '#convert_spec' do
|
240
|
-
include_context 'isolated environment'
|
241
|
-
|
242
|
-
let(:processed_source) do
|
243
|
-
path = 'example.rb'
|
244
|
-
create_file(path, source)
|
245
|
-
ProcessedSource.from_file(path)
|
246
|
-
end
|
247
|
-
|
248
|
-
let(:spec_suite) { SpecSuite.new }
|
249
|
-
|
250
|
-
before do
|
251
|
-
cli.stub(:puts)
|
252
|
-
end
|
253
|
-
|
254
|
-
context 'when the source has a monkey-patched expectation outside of example group context' do
|
255
|
-
let(:source) do
|
256
|
-
<<-END
|
257
|
-
describe 'example group' do
|
258
|
-
class Klass
|
259
|
-
def some_method
|
260
|
-
1.should == 1
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
it 'is an example' do
|
265
|
-
Klass.new.some_method
|
266
|
-
end
|
267
|
-
end
|
268
|
-
END
|
269
|
-
end
|
270
|
-
|
271
|
-
it 'warns of the conversion error' do
|
272
|
-
cli.should_receive(:warn) do |message|
|
273
|
-
message.should =~ /cannot/i
|
274
|
-
message.should =~ /context/i
|
275
|
-
end
|
276
|
-
|
277
|
-
cli.convert_spec(processed_source, spec_suite)
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
context 'when it did a less accurate conversion due to a lack of runtime information' do
|
282
|
-
let(:source) do
|
283
|
-
<<-END
|
284
|
-
describe 'example group' do
|
285
|
-
it 'is an example' do
|
286
|
-
expect(obj).to have(2).items
|
287
|
-
end
|
288
|
-
end
|
289
|
-
END
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'warns of less accurate conversion' do
|
293
|
-
cli.should_receive(:warn).with(/converted.+but.+incorrect/i)
|
294
|
-
cli.convert_spec(processed_source, spec_suite)
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
context 'when both conversion errors and less accurate records are reported' do
|
299
|
-
let(:source) do
|
300
|
-
<<-END
|
301
|
-
describe 'example group' do
|
302
|
-
it 'is first' do
|
303
|
-
expect(obj).to have(1).item
|
304
|
-
end
|
305
|
-
|
306
|
-
class Klass
|
307
|
-
def second
|
308
|
-
2.should == 2
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
it 'is an example' do
|
313
|
-
Klass.new.some_method
|
314
|
-
end
|
315
|
-
|
316
|
-
it 'is third' do
|
317
|
-
expect(obj).to have(3).items
|
318
|
-
end
|
319
|
-
end
|
320
|
-
END
|
321
|
-
end
|
322
|
-
|
323
|
-
it 'displays them in order of line number' do
|
324
|
-
times = 1
|
325
|
-
|
326
|
-
cli.should_receive(:warn).exactly(3).times do |message|
|
327
|
-
line_number = case times
|
328
|
-
when 1 then 3
|
329
|
-
when 2 then 8
|
330
|
-
when 3 then 17
|
331
|
-
end
|
332
|
-
message.should include(":#{line_number}:")
|
333
|
-
times += 1
|
334
|
-
end
|
335
|
-
|
336
|
-
cli.convert_spec(processed_source, spec_suite)
|
337
|
-
end
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|