transpec 2.2.5 → 2.3.0

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/transpec/conversion_error.rb +5 -5
  4. data/lib/transpec/converter.rb +14 -12
  5. data/lib/transpec/record.rb +88 -31
  6. data/lib/transpec/report.rb +19 -11
  7. data/lib/transpec/rspec_version.rb +9 -0
  8. data/lib/transpec/syntax/be_boolean.rb +2 -2
  9. data/lib/transpec/syntax/be_close.rb +1 -1
  10. data/lib/transpec/syntax/current_example.rb +35 -17
  11. data/lib/transpec/syntax/double.rb +1 -1
  12. data/lib/transpec/syntax/example.rb +0 -4
  13. data/lib/transpec/syntax/example_group.rb +11 -11
  14. data/lib/transpec/syntax/have/{have_record.rb → record_builder.rb} +15 -17
  15. data/lib/transpec/syntax/have.rb +2 -2
  16. data/lib/transpec/syntax/hook.rb +3 -3
  17. data/lib/transpec/syntax/its.rb +25 -17
  18. data/lib/transpec/syntax/matcher_definition.rb +1 -2
  19. data/lib/transpec/syntax/method_stub.rb +44 -51
  20. data/lib/transpec/syntax/mixin/any_instance_block.rb +8 -6
  21. data/lib/transpec/syntax/mixin/useless_and_return.rb +9 -7
  22. data/lib/transpec/syntax/oneliner_should.rb +29 -27
  23. data/lib/transpec/syntax/operator.rb +3 -3
  24. data/lib/transpec/syntax/pending.rb +0 -4
  25. data/lib/transpec/syntax/raise_error.rb +35 -15
  26. data/lib/transpec/syntax/receive.rb +6 -6
  27. data/lib/transpec/syntax/rspec_configure/config_modification.rb +39 -5
  28. data/lib/transpec/syntax/rspec_configure/framework.rb +27 -7
  29. data/lib/transpec/syntax/rspec_configure/mocks.rb +2 -2
  30. data/lib/transpec/syntax/rspec_configure.rb +35 -4
  31. data/lib/transpec/syntax/should.rb +35 -20
  32. data/lib/transpec/syntax/should_receive.rb +30 -27
  33. data/lib/transpec/syntax.rb +10 -0
  34. data/lib/transpec/version.rb +2 -2
  35. data/spec/integration/configuration_modification_spec.rb +43 -3
  36. data/spec/transpec/record_spec.rb +113 -18
  37. data/spec/transpec/report_spec.rb +15 -6
  38. data/spec/transpec/rspec_version_spec.rb +5 -0
  39. data/spec/transpec/syntax/be_boolean_spec.rb +10 -10
  40. data/spec/transpec/syntax/be_close_spec.rb +2 -2
  41. data/spec/transpec/syntax/current_example_spec.rb +6 -6
  42. data/spec/transpec/syntax/double_spec.rb +2 -2
  43. data/spec/transpec/syntax/example_group_spec.rb +4 -4
  44. data/spec/transpec/syntax/example_spec.rb +8 -8
  45. data/spec/transpec/syntax/have_spec.rb +44 -44
  46. data/spec/transpec/syntax/hook_spec.rb +8 -8
  47. data/spec/transpec/syntax/its_spec.rb +16 -16
  48. data/spec/transpec/syntax/matcher_definition_spec.rb +2 -2
  49. data/spec/transpec/syntax/method_stub_spec.rb +36 -36
  50. data/spec/transpec/syntax/oneliner_should_spec.rb +26 -26
  51. data/spec/transpec/syntax/operator_spec.rb +18 -18
  52. data/spec/transpec/syntax/pending_spec.rb +6 -6
  53. data/spec/transpec/syntax/raise_error_spec.rb +10 -10
  54. data/spec/transpec/syntax/receive_spec.rb +20 -20
  55. data/spec/transpec/syntax/rspec_configure_spec.rb +202 -18
  56. data/spec/transpec/syntax/should_receive_spec.rb +30 -30
  57. data/spec/transpec/syntax/should_spec.rb +8 -8
  58. data/tasks/fixtures/mail/2.99.0/COMMIT_EDITMSG +1 -1
  59. data/tasks/fixtures/mail/3.0.0/COMMIT_EDITMSG +5 -2
  60. data/tasks/fixtures/twitter/2.99.0/COMMIT_EDITMSG +1 -1
  61. data/tasks/fixtures/twitter/3.0.0/COMMIT_EDITMSG +2 -2
  62. metadata +2 -2
@@ -25,7 +25,7 @@ module Transpec
25
25
  const_name(receiver_node) == 'RSpec' && method_name == :configure && parent_node.block_type?
26
26
  end
27
27
 
28
- def expose_dsl_globally=(boolean)
28
+ def expose_dsl_globally=(value)
29
29
  comment = <<-END.gsub(/^\s+\|/, '').chomp
30
30
  |Setting this config option `false` removes rspec-core's monkey patching of the
31
31
  |top level methods like `describe`, `shared_examples_for` and `shared_context`
@@ -35,7 +35,7 @@ module Transpec
35
35
  |
36
36
  |https://relishapp.com/rspec/rspec-core/v/3-0/docs/configuration/global-namespace-dsl
37
37
  END
38
- set_config!(:expose_dsl_globally, boolean, comment)
38
+ set_config_value!(:expose_dsl_globally, value, comment)
39
39
  end
40
40
 
41
41
  def infer_spec_type_from_file_location!
@@ -69,12 +69,43 @@ module Transpec
69
69
  !find_config_node(:infer_spec_type_from_file_location!).nil?
70
70
  end
71
71
 
72
+ def convert_deprecated_options!(rspec_version) # rubocop:disable MethodLength
73
+ replace_config!(:backtrace_clean_patterns, :backtrace_exclusion_patterns)
74
+ replace_config!(:backtrace_clean_patterns=, :backtrace_exclusion_patterns=)
75
+ replace_config!(:color_enabled=, :color=)
76
+
77
+ if rspec_version.config_output_stream_available?
78
+ replace_config!(:output, :output_stream)
79
+ replace_config!(:output=, :output_stream=)
80
+ replace_config!(:out, :output_stream)
81
+ replace_config!(:out=, :output_stream=)
82
+ end
83
+
84
+ if rspec_version.config_pattern_available?
85
+ replace_config!(:filename_pattern, :pattern)
86
+ replace_config!(:filename_pattern=, :pattern=)
87
+ end
88
+
89
+ if rspec_version.config_backtrace_formatter_available?
90
+ replace_config!(:backtrace_cleaner, :backtrace_formatter)
91
+ replace_config!(:backtrace_cleaner=, :backtrace_formatter=)
92
+ end
93
+
94
+ if rspec_version.config_predicate_color_enabled_available?
95
+ replace_config!(:color?, :color_enabled?)
96
+ end
97
+
98
+ if rspec_version.config_predicate_warnings_available?
99
+ replace_config!(:warnings, :warnings?)
100
+ end
101
+ end
102
+
72
103
  def expectations
73
- @expectations ||= Expectations.new(self, source_rewriter)
104
+ @expectations ||= Expectations.new(self)
74
105
  end
75
106
 
76
107
  def mocks
77
- @mocks ||= Mocks.new(self, source_rewriter)
108
+ @mocks ||= Mocks.new(self)
78
109
  end
79
110
 
80
111
  alias_method :block_node, :parent_node
@@ -42,13 +42,7 @@ module Transpec
42
42
  replace(should_range, positive? ? 'to' : negative_form)
43
43
 
44
44
  @current_syntax_type = :expect
45
- add_record(negative_form)
46
- end
47
-
48
- private
49
-
50
- def expect_available?
51
- syntax_available?(__method__)
45
+ add_record(RecordBuilder.build(self, negative_form))
52
46
  end
53
47
 
54
48
  def proc_subject?
@@ -59,28 +53,49 @@ module Transpec
59
53
  receiver_node.nil? && method_name == :expect
60
54
  end
61
55
 
56
+ def name_of_subject_method_taking_block
57
+ range_of_subject_method_taking_block.source
58
+ end
59
+
60
+ private
61
+
62
+ def expect_available?
63
+ syntax_available?(__method__)
64
+ end
65
+
62
66
  def range_of_subject_method_taking_block
63
67
  send_node = subject_node.children.first
64
68
  send_node.loc.expression
65
69
  end
66
70
 
67
- def add_record(negative_form_of_to)
68
- if proc_subject?
69
- original_syntax = "#{range_of_subject_method_taking_block.source} { }.should"
70
- converted_syntax = 'expect { }.'
71
- else
72
- original_syntax = 'obj.should'
73
- converted_syntax = 'expect(obj).'
71
+ class RecordBuilder < Transpec::RecordBuilder
72
+ attr_reader :should, :negative_form_of_to
73
+
74
+ def initialize(should, negative_form_of_to)
75
+ @should = should
76
+ @negative_form_of_to = negative_form_of_to
74
77
  end
75
78
 
76
- if positive?
77
- converted_syntax << 'to'
78
- else
79
- original_syntax << '_not'
80
- converted_syntax << negative_form_of_to
79
+ def old_syntax
80
+ syntax = if should.proc_subject?
81
+ "#{should.name_of_subject_method_taking_block} { }.should"
82
+ else
83
+ 'obj.should'
84
+ end
85
+
86
+ syntax << '_not' unless should.positive?
87
+ syntax
81
88
  end
82
89
 
83
- report.records << Record.new(original_syntax, converted_syntax)
90
+ def new_syntax
91
+ syntax = if should.proc_subject?
92
+ 'expect { }.'
93
+ else
94
+ 'expect(obj).'
95
+ end
96
+
97
+ syntax << (should.positive? ? 'to' : negative_form_of_to)
98
+ end
84
99
  end
85
100
  end
86
101
  end
@@ -51,7 +51,8 @@ module Transpec
51
51
  end
52
52
 
53
53
  convert_to_syntax!('expect', negative_form)
54
- add_record(ExpectRecord, negative_form)
54
+
55
+ add_record(ExpectRecordBuilder.build(self, negative_form))
55
56
  end
56
57
 
57
58
  def allowize_useless_expectation!(negative_form = 'not_to')
@@ -64,7 +65,7 @@ module Transpec
64
65
  convert_to_syntax!('allow', negative_form)
65
66
  remove_no_message_allowance!
66
67
 
67
- add_record(AllowRecord, negative_form)
68
+ add_record(AllowRecordBuilder.build(self, negative_form))
68
69
  end
69
70
 
70
71
  def stubize_useless_expectation!
@@ -73,15 +74,17 @@ module Transpec
73
74
  replace(selector_range, 'stub')
74
75
  remove_no_message_allowance!
75
76
 
76
- add_record(StubRecord)
77
+ add_record(StubRecordBuilder.build(self))
77
78
  end
78
79
 
79
80
  def remove_useless_and_return!
80
- super && add_record(MonkeyPatchUselessAndReturnRecord)
81
+ return unless super
82
+ add_record(Mixin::UselessAndReturn::MonkeyPatchRecordBuilder.build(self))
81
83
  end
82
84
 
83
85
  def add_receiver_arg_to_any_instance_implementation_block!
84
- super && add_record(MonkeyPatchAnyInstanceBlockRecord)
86
+ return unless super
87
+ add_record(Mixin::AnyInstanceBlock::MonkeyPatchRecordBuilder.build(self))
85
88
  end
86
89
 
87
90
  private
@@ -158,11 +161,9 @@ module Transpec
158
161
  end
159
162
  end
160
163
 
161
- def add_record(record_class, negative_form_of_to = nil)
162
- report.records << record_class.new(self, negative_form_of_to)
163
- end
164
+ class ExpectBaseRecordBuilder < RecordBuilder
165
+ attr_reader :should_receive, :negative_form_of_to
164
166
 
165
- class ExpectBaseRecord < Record
166
167
  def initialize(should_receive, negative_form_of_to)
167
168
  @should_receive = should_receive
168
169
  @negative_form_of_to = negative_form_of_to
@@ -172,58 +173,60 @@ module Transpec
172
173
  fail NotImplementedError
173
174
  end
174
175
 
175
- def build_original_syntax
176
- syntax = if @should_receive.any_instance?
176
+ def old_syntax
177
+ syntax = if should_receive.any_instance?
177
178
  'Klass.any_instance.'
178
179
  else
179
180
  'obj.'
180
181
  end
181
- syntax << "#{@should_receive.method_name}(:message)"
182
+ syntax << "#{should_receive.method_name}(:message)"
182
183
  end
183
184
 
184
- def build_converted_syntax
185
- syntax = if @should_receive.any_instance?
185
+ def new_syntax
186
+ syntax = if should_receive.any_instance?
186
187
  "#{syntax_name}_any_instance_of(Klass)."
187
188
  else
188
189
  "#{syntax_name}(obj)."
189
190
  end
190
- syntax << (@should_receive.positive? ? 'to' : @negative_form_of_to)
191
+ syntax << (should_receive.positive? ? 'to' : negative_form_of_to)
191
192
  syntax << ' receive(:message)'
192
193
  end
193
194
  end
194
195
 
195
- class ExpectRecord < ExpectBaseRecord
196
+ class ExpectRecordBuilder < ExpectBaseRecordBuilder
196
197
  def syntax_name
197
198
  'expect'
198
199
  end
199
200
  end
200
201
 
201
- class AllowRecord < ExpectBaseRecord
202
+ class AllowRecordBuilder < ExpectBaseRecordBuilder
202
203
  def syntax_name
203
204
  'allow'
204
205
  end
205
206
 
206
- def build_original_syntax
207
+ def old_syntax
207
208
  syntax = super
208
- syntax << '.any_number_of_times' if @should_receive.any_number_of_times?
209
- syntax << '.at_least(0)' if @should_receive.at_least_zero?
209
+ syntax << '.any_number_of_times' if should_receive.any_number_of_times?
210
+ syntax << '.at_least(0)' if should_receive.at_least_zero?
210
211
  syntax
211
212
  end
212
213
  end
213
214
 
214
- class StubRecord < Record
215
- def initialize(should_receive, *)
215
+ class StubRecordBuilder < RecordBuilder
216
+ attr_reader :should_receive
217
+
218
+ def initialize(should_receive)
216
219
  @should_receive = should_receive
217
220
  end
218
221
 
219
- def build_original_syntax
220
- syntax = "obj.#{@should_receive.method_name}(:message)"
221
- syntax << '.any_number_of_times' if @should_receive.any_number_of_times?
222
- syntax << '.at_least(0)' if @should_receive.at_least_zero?
222
+ def old_syntax
223
+ syntax = "obj.#{should_receive.method_name}(:message)"
224
+ syntax << '.any_number_of_times' if should_receive.any_number_of_times?
225
+ syntax << '.at_least(0)' if should_receive.at_least_zero?
223
226
  syntax
224
227
  end
225
228
 
226
- def build_converted_syntax
229
+ def new_syntax
227
230
  'obj.stub(:message)'
228
231
  end
229
232
  end
@@ -189,5 +189,15 @@ module Transpec
189
189
  def inspect
190
190
  "#<#{self.class}: #{node.type}>"
191
191
  end
192
+
193
+ def add_record(*args)
194
+ record = if args.first.is_a?(Record)
195
+ args.first
196
+ else
197
+ Record.new(*args)
198
+ end
199
+
200
+ report.records << record
201
+ end
192
202
  end
193
203
  end
@@ -4,8 +4,8 @@ module Transpec
4
4
  # http://semver.org/
5
5
  module Version
6
6
  MAJOR = 2
7
- MINOR = 2
8
- PATCH = 5
7
+ MINOR = 3
8
+ PATCH = 0
9
9
 
10
10
  def self.to_s
11
11
  [MAJOR, MINOR, PATCH].join('.')
@@ -16,7 +16,7 @@ module Transpec
16
16
  end
17
17
 
18
18
  context 'when there are multiple RSpec.configure in the spec suite' do
19
- before do
19
+ it 'adds new options only to the one that was run first' do
20
20
  create_file('spec/spec_helper.rb', <<-END)
21
21
  RSpec.configure do |config|
22
22
  end
@@ -39,9 +39,7 @@ module Transpec
39
39
  end
40
40
  end
41
41
  END
42
- end
43
42
 
44
- it 'modifies only the one that was run first' do
45
43
  cli.project.stub(:rspec_version).and_return(RSpecVersion.new('2.99.0'))
46
44
  cli.run([])
47
45
 
@@ -67,6 +65,48 @@ module Transpec
67
65
  end
68
66
  END
69
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
70
110
  end
71
111
 
72
112
  describe 'yield_receiver_to_any_instance_implementation_blocks' do
@@ -5,28 +5,123 @@ require 'transpec/record'
5
5
 
6
6
  module Transpec
7
7
  describe Record do
8
- subject(:report) { Record.new(original_syntax, converted_syntax) }
9
- let(:original_syntax) { 'obj.should' }
10
- let(:converted_syntax) { 'expect(obj).to' }
11
-
12
- [
13
- :original_syntax,
14
- :original_syntax_type,
15
- :converted_syntax,
16
- :converted_syntax_type
17
- ].each do |method|
18
- it "forbids override of ##{method}" do
19
- lambda do
20
- Class.new(Record) do
21
- define_method(method) {}
22
- end
23
- end.should raise_error(/override/)
8
+ subject(:record) { Record.new(old_syntax, new_syntax, options) }
9
+ let(:old_syntax) { 'obj.should' }
10
+ let(:new_syntax) { 'expect(obj).to' }
11
+ let(:options) { {} }
12
+
13
+ describe '.new' do
14
+ context 'when invalid type is passed' do
15
+ it 'raises error' do
16
+ lambda do
17
+ Record.new('foo', 'bar', type: :unknown_type)
18
+ end.should raise_error(/invalid type/i)
19
+ end
20
+ end
21
+ end
22
+
23
+ describe '#type' do
24
+ subject { record.type }
25
+
26
+ context 'when it has both old and new syntaxes' do
27
+ let(:old_syntax) { 'obj.should' }
28
+ let(:new_syntax) { 'expect(obj).to' }
29
+ it { should == :conversion }
30
+ end
31
+
32
+ context 'when it has only new syntax' do
33
+ let(:old_syntax) { nil }
34
+ let(:new_syntax) { 'expect(obj).to' }
35
+ it { should == :addition }
36
+ end
37
+
38
+ context 'when it has only old syntax' do
39
+ let(:old_syntax) { 'obj.should' }
40
+ let(:new_syntax) { nil }
41
+ it { should == :removal }
42
+ end
43
+
44
+ context 'when the type is specified explicitly' do
45
+ let(:old_syntax) { 'foo = true' }
46
+ let(:new_syntax) { 'foo = false' }
47
+ let(:options) { { type: :modification } }
48
+ it { should == :modification }
24
49
  end
25
50
  end
26
51
 
27
52
  describe '#to_s' do
28
- it 'returns "`original syntax` -> `converted syntax`"' do
29
- report.to_s.should == '`obj.should` -> `expect(obj).to`'
53
+ subject { record.to_s }
54
+
55
+ context "when it's a conversion" do
56
+ let(:old_syntax) { 'obj.should' }
57
+ let(:new_syntax) { 'expect(obj).to' }
58
+
59
+ it 'returns "Conversion from `old syntax` to `new syntax`"' do
60
+ record.to_s.should == 'Conversion from `obj.should` to `expect(obj).to`'
61
+ end
62
+ end
63
+
64
+ context "when it's an addition" do
65
+ let(:old_syntax) { nil }
66
+ let(:new_syntax) { 'expect(obj).to' }
67
+
68
+ it 'returns "Addition of `new syntax`"' do
69
+ record.to_s.should == 'Addition of `expect(obj).to`'
70
+ end
71
+ end
72
+
73
+ context "when it's a removal" do
74
+ let(:old_syntax) { 'obj.should' }
75
+ let(:new_syntax) { nil }
76
+
77
+ it 'returns "Removal of `old syntax`"' do
78
+ record.to_s.should == 'Removal of `obj.should`'
79
+ end
80
+ end
81
+ end
82
+ end
83
+
84
+ describe RecordBuilder do
85
+ describe '.build' do
86
+ builder_class = Class.new(RecordBuilder) do
87
+ attr_reader :some_attr
88
+
89
+ def initialize(some_attr)
90
+ @some_attr = some_attr
91
+ end
92
+
93
+ def old_syntax
94
+ "obj.should be #{some_attr}"
95
+ end
96
+
97
+ def new_syntax
98
+ "expect(obj).to be #{some_attr}"
99
+ end
100
+
101
+ def type
102
+ :modification
103
+ end
104
+
105
+ def annotation
106
+ 'some annotation'
107
+ end
108
+ end
109
+
110
+ let(:record) { builder_class.build('something') }
111
+
112
+ it 'returns an instance of Record' do
113
+ record.should be_a(Record)
114
+ end
115
+
116
+ {
117
+ old_syntax: 'obj.should be something',
118
+ new_syntax: 'expect(obj).to be something',
119
+ type: :modification,
120
+ annotation: 'some annotation'
121
+ }.each do |attribute, value|
122
+ it "sets builder's ##{attribute} value to record's ##{attribute}" do
123
+ record.send(attribute).should == value
124
+ end
30
125
  end
31
126
  end
32
127
  end
@@ -10,9 +10,11 @@ module Transpec
10
10
  subject(:report) { Report.new }
11
11
 
12
12
  before do
13
- report.records << Record.new('obj.stub(:message)', 'allow(obj).to receive(:message)', double('annotation'))
13
+ options = { annotation: double('annotation') }
14
+ report.records << Record.new('obj.stub(:message)', 'allow(obj).to receive(:message)', options)
14
15
  report.records << Record.new('obj.should', 'expect(obj).to')
15
- report.records << Record.new('obj.should', 'expect(obj).to', double('annotation'))
16
+ report.records << Record.new('obj.should', 'expect(obj).to', options)
17
+ report.records << Record.new(nil, 'RSpec.configure { |c| c.infer_spec_type_from_file_location! }')
16
18
  report.conversion_errors << ContextError.new('#should', '#expect', double('range'))
17
19
  end
18
20
 
@@ -20,7 +22,7 @@ module Transpec
20
22
  subject(:unique_record_counts) { report.unique_record_counts }
21
23
 
22
24
  it 'returns counts for unique records' do
23
- unique_record_counts.size.should == 2
25
+ unique_record_counts.size.should == 3
24
26
  end
25
27
 
26
28
  it 'returns hash with record as key and count as value' do
@@ -35,7 +37,7 @@ module Transpec
35
37
  end
36
38
 
37
39
  it 'is sorted by count in descending order' do
38
- unique_record_counts.values.should == [2, 1]
40
+ unique_record_counts.values.should == [2, 1, 1]
39
41
  end
40
42
  end
41
43
 
@@ -48,6 +50,8 @@ module Transpec
48
50
  |1 conversion
49
51
  | from: obj.stub(:message)
50
52
  | to: allow(obj).to receive(:message)
53
+ |1 addition
54
+ | of: RSpec.configure { |c| c.infer_spec_type_from_file_location! }
51
55
  END
52
56
  end
53
57
 
@@ -61,6 +65,9 @@ module Transpec
61
65
  |1 conversion
62
66
  | from: obj.stub(:message)
63
67
  | to: allow(obj).to receive(:message)
68
+ |
69
+ |1 addition
70
+ | of: RSpec.configure { |c| c.infer_spec_type_from_file_location! }
64
71
  END
65
72
  end
66
73
  end
@@ -74,6 +81,8 @@ module Transpec
74
81
  |- 1 conversion
75
82
  | from: obj.stub(:message)
76
83
  | to: allow(obj).to receive(:message)
84
+ |- 1 addition
85
+ | of: RSpec.configure { |c| c.infer_spec_type_from_file_location! }
77
86
  END
78
87
  end
79
88
  end
@@ -81,7 +90,7 @@ module Transpec
81
90
 
82
91
  describe '#stats' do
83
92
  it 'returns stats string' do
84
- report.stats.should == '3 conversions, 1 incomplete, 2 warnings, 0 errors'
93
+ report.stats.should == '4 conversions, 1 incomplete, 2 warnings, 0 errors'
85
94
  end
86
95
  end
87
96
 
@@ -102,7 +111,7 @@ module Transpec
102
111
  end
103
112
 
104
113
  it 'concats records' do
105
- concated_report.should have(4).records
114
+ concated_report.should have(5).records
106
115
  end
107
116
 
108
117
  it 'concats conversion errors' do
@@ -26,6 +26,7 @@ module Transpec
26
26
  [
27
27
  :be_truthy_available?,
28
28
  :yielded_example_available?,
29
+ :config_output_stream_available?,
29
30
  :yielding_receiver_to_any_instance_implementation_block_available?
30
31
  ].each do |method|
31
32
  include_examples 'version comparisons', method, [
@@ -59,6 +60,10 @@ module Transpec
59
60
  end
60
61
 
61
62
  [
63
+ :config_pattern_available?,
64
+ :config_backtrace_formatter_available?,
65
+ :config_predicate_color_enabled_available?,
66
+ :config_predicate_warnings_available?,
62
67
  :implicit_spec_type_disablement_available?
63
68
  ].each do |method|
64
69
  include_examples 'version comparisons', method, [
@@ -44,8 +44,8 @@ module Transpec
44
44
  end
45
45
 
46
46
  it 'adds record `be_true` -> `be_truthy`' do
47
- record.original_syntax.should == 'be_true'
48
- record.converted_syntax.should == 'be_truthy'
47
+ record.old_syntax.should == 'be_true'
48
+ record.new_syntax.should == 'be_truthy'
49
49
  end
50
50
  end
51
51
 
@@ -75,8 +75,8 @@ module Transpec
75
75
  end
76
76
 
77
77
  it 'adds record `be_false` -> `be_falsey`' do
78
- record.original_syntax.should == 'be_false'
79
- record.converted_syntax.should == 'be_falsey'
78
+ record.old_syntax.should == 'be_false'
79
+ record.new_syntax.should == 'be_falsey'
80
80
  end
81
81
 
82
82
  context 'and "be_falsy" is passed' do
@@ -97,8 +97,8 @@ module Transpec
97
97
  end
98
98
 
99
99
  it 'adds record `be_false` -> `be_falsy`' do
100
- record.original_syntax.should == 'be_false'
101
- record.converted_syntax.should == 'be_falsy'
100
+ record.old_syntax.should == 'be_false'
101
+ record.new_syntax.should == 'be_falsy'
102
102
  end
103
103
  end
104
104
  end
@@ -135,8 +135,8 @@ module Transpec
135
135
  end
136
136
 
137
137
  it 'adds record `be_true` -> `be true`' do
138
- record.original_syntax.should == 'be_true'
139
- record.converted_syntax.should == 'be true'
138
+ record.old_syntax.should == 'be_true'
139
+ record.new_syntax.should == 'be true'
140
140
  end
141
141
  end
142
142
 
@@ -166,8 +166,8 @@ module Transpec
166
166
  end
167
167
 
168
168
  it 'adds record `be_false` -> `be false`' do
169
- record.original_syntax.should == 'be_false'
170
- record.converted_syntax.should == 'be false'
169
+ record.old_syntax.should == 'be_false'
170
+ record.new_syntax.should == 'be false'
171
171
  end
172
172
  end
173
173
  end
@@ -41,8 +41,8 @@ module Transpec
41
41
 
42
42
  it 'adds record `be_close(expected, delta)` -> `be_within(delta).of(expected)`' do
43
43
  record = be_close_object.report.records.first
44
- record.original_syntax.should == 'be_close(expected, delta)'
45
- record.converted_syntax.should == 'be_within(delta).of(expected)'
44
+ record.old_syntax.should == 'be_close(expected, delta)'
45
+ record.new_syntax.should == 'be_within(delta).of(expected)'
46
46
  end
47
47
  end
48
48
  end