transpec 1.8.0 → 1.9.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +106 -79
- data/README.md.erb +91 -73
- data/lib/transpec/cli.rb +1 -1
- data/lib/transpec/converter.rb +16 -5
- data/lib/transpec/syntax/allow.rb +4 -0
- data/lib/transpec/syntax/expect.rb +4 -0
- data/lib/transpec/syntax/have.rb +24 -13
- data/lib/transpec/syntax/method_stub.rb +42 -6
- data/lib/transpec/syntax/mixin/any_instance_block.rb +14 -5
- data/lib/transpec/syntax/mixin/expect_base.rb +6 -5
- data/lib/transpec/syntax/mixin/messaging_host.rb +17 -0
- data/lib/transpec/syntax/mixin/{allow_no_message.rb → no_message_allowance.rb} +5 -4
- data/lib/transpec/syntax/mixin/send.rb +0 -13
- data/lib/transpec/syntax/mixin/should_base.rb +7 -1
- data/lib/transpec/syntax/mixin/useless_and_return.rb +79 -0
- data/lib/transpec/syntax/operator_matcher.rb +20 -4
- data/lib/transpec/syntax/receive.rb +21 -6
- data/lib/transpec/syntax/should_receive.rb +14 -11
- data/lib/transpec/util.rb +46 -0
- data/lib/transpec/version.rb +1 -1
- data/spec/transpec/converter_spec.rb +60 -18
- data/spec/transpec/syntax/expect_spec.rb +41 -9
- data/spec/transpec/syntax/method_stub_spec.rb +99 -2
- data/spec/transpec/syntax/operator_matcher_spec.rb +19 -84
- data/spec/transpec/syntax/receive_spec.rb +231 -2
- data/spec/transpec/syntax/should_receive_spec.rb +38 -0
- data/spec/transpec/syntax/should_spec.rb +28 -39
- data/tasks/readme.rake +16 -2
- metadata +5 -3
@@ -985,9 +985,9 @@ module Transpec
|
|
985
985
|
end
|
986
986
|
end
|
987
987
|
|
988
|
-
describe '#
|
988
|
+
describe '#remove_no_message_allowance!' do
|
989
989
|
before do
|
990
|
-
method_stub_object.
|
990
|
+
method_stub_object.remove_no_message_allowance!
|
991
991
|
end
|
992
992
|
|
993
993
|
context 'when it is `subject.stub(:method).any_number_of_times` form' do
|
@@ -1014,6 +1014,12 @@ module Transpec
|
|
1014
1014
|
it 'removes `.any_number_of_times`' do
|
1015
1015
|
rewritten_source.should == expected_source
|
1016
1016
|
end
|
1017
|
+
|
1018
|
+
it 'adds record ' \
|
1019
|
+
'`obj.stub(:message).any_number_of_times` -> `obj.stub(:message)`' do
|
1020
|
+
record.original_syntax.should == 'obj.stub(:message).any_number_of_times'
|
1021
|
+
record.converted_syntax.should == 'obj.stub(:message)'
|
1022
|
+
end
|
1017
1023
|
end
|
1018
1024
|
|
1019
1025
|
context 'when it is `subject.stub(:method).at_least(0)` form' do
|
@@ -1040,6 +1046,12 @@ module Transpec
|
|
1040
1046
|
it 'removes `.at_least(0)`' do
|
1041
1047
|
rewritten_source.should == expected_source
|
1042
1048
|
end
|
1049
|
+
|
1050
|
+
it 'adds record ' \
|
1051
|
+
'`obj.stub(:message).at_least(0)` -> `obj.stub(:message)`' do
|
1052
|
+
record.original_syntax.should == 'obj.stub(:message).at_least(0)'
|
1053
|
+
record.converted_syntax.should == 'obj.stub(:message)'
|
1054
|
+
end
|
1043
1055
|
end
|
1044
1056
|
|
1045
1057
|
context 'when it is `subject.stub(:method)` form' do
|
@@ -1059,6 +1071,91 @@ module Transpec
|
|
1059
1071
|
end
|
1060
1072
|
end
|
1061
1073
|
|
1074
|
+
describe '#remove_useless_and_return!' do
|
1075
|
+
before do
|
1076
|
+
method_stub_object.remove_useless_and_return!
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
context 'when it is `subject.stub(:method).and_return { value }` form' do
|
1080
|
+
let(:source) do
|
1081
|
+
<<-END
|
1082
|
+
describe 'example' do
|
1083
|
+
it 'responds to #foo and returns 1' do
|
1084
|
+
subject.stub(:foo).and_return { 1 }
|
1085
|
+
end
|
1086
|
+
end
|
1087
|
+
END
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
let(:expected_source) do
|
1091
|
+
<<-END
|
1092
|
+
describe 'example' do
|
1093
|
+
it 'responds to #foo and returns 1' do
|
1094
|
+
subject.stub(:foo) { 1 }
|
1095
|
+
end
|
1096
|
+
end
|
1097
|
+
END
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
it 'converts into `subject.stub(:method) { value }` form' do
|
1101
|
+
rewritten_source.should == expected_source
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
it 'adds record `obj.stub(:message).and_return { value }` -> `obj.stub(:message) { value }`' do
|
1105
|
+
record.original_syntax.should == 'obj.stub(:message).and_return { value }'
|
1106
|
+
record.converted_syntax.should == 'obj.stub(:message) { value }'
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
context 'when it is `subject.stub(:method).and_return` form' do
|
1111
|
+
let(:source) do
|
1112
|
+
<<-END
|
1113
|
+
describe 'example' do
|
1114
|
+
it 'responds to #foo' do
|
1115
|
+
subject.stub(:foo).and_return
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
END
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
let(:expected_source) do
|
1122
|
+
<<-END
|
1123
|
+
describe 'example' do
|
1124
|
+
it 'responds to #foo' do
|
1125
|
+
subject.stub(:foo)
|
1126
|
+
end
|
1127
|
+
end
|
1128
|
+
END
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
it 'converts into `subject.stub(:method)` form' do
|
1132
|
+
rewritten_source.should == expected_source
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
it 'adds record `obj.stub(:message).and_return` -> `obj.stub(:message)`' do
|
1136
|
+
record.original_syntax.should == 'obj.stub(:message).and_return'
|
1137
|
+
record.converted_syntax.should == 'obj.stub(:message)'
|
1138
|
+
end
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
context 'when it is `subject.stub(:method).and_return(value)` form' do
|
1142
|
+
let(:source) do
|
1143
|
+
<<-END
|
1144
|
+
describe 'example' do
|
1145
|
+
it 'responds to #foo and returns 1' do
|
1146
|
+
subject.stub(:foo).and_return(1)
|
1147
|
+
end
|
1148
|
+
end
|
1149
|
+
END
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
it 'does nothing' do
|
1153
|
+
rewritten_source.should == source
|
1154
|
+
record.should be_nil
|
1155
|
+
end
|
1156
|
+
end
|
1157
|
+
end
|
1158
|
+
|
1062
1159
|
describe '#add_receiver_arg_to_any_instance_implementation_block!' do
|
1063
1160
|
before do
|
1064
1161
|
method_stub_object.add_receiver_arg_to_any_instance_implementation_block!
|
@@ -11,61 +11,22 @@ module Transpec
|
|
11
11
|
include_context 'parsed objects'
|
12
12
|
include_context 'syntax object', Should, :should_object
|
13
13
|
|
14
|
-
subject(:matcher)
|
15
|
-
OperatorMatcher.new(should_object.matcher_node, source_rewriter, runtime_data)
|
16
|
-
end
|
17
|
-
|
14
|
+
subject(:matcher) { should_object.operator_matcher }
|
18
15
|
let(:record) { matcher.report.records.first }
|
19
16
|
|
20
17
|
describe '#method_name' do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
subject.should == 1
|
27
|
-
end
|
18
|
+
let(:source) do
|
19
|
+
<<-END
|
20
|
+
describe 'example' do
|
21
|
+
it 'is 1' do
|
22
|
+
subject.should == 1
|
28
23
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# (block
|
33
|
-
# (send nil :it
|
34
|
-
# (str "is 1"))
|
35
|
-
# (args)
|
36
|
-
# (send
|
37
|
-
# (send
|
38
|
-
# (send nil :subject) :should) :==
|
39
|
-
# (int 1)))
|
40
|
-
|
41
|
-
it 'returns the method name' do
|
42
|
-
matcher.method_name.should == :==
|
43
|
-
end
|
24
|
+
end
|
25
|
+
END
|
44
26
|
end
|
45
27
|
|
46
|
-
|
47
|
-
|
48
|
-
<<-END
|
49
|
-
describe 'example' do
|
50
|
-
it 'is 1' do
|
51
|
-
subject.should eq(1)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
END
|
55
|
-
end
|
56
|
-
|
57
|
-
# (block
|
58
|
-
# (send nil :it
|
59
|
-
# (str "is 1"))
|
60
|
-
# (args)
|
61
|
-
# (send
|
62
|
-
# (send nil :subject) :should
|
63
|
-
# (send nil :eq
|
64
|
-
# (int 1))))
|
65
|
-
|
66
|
-
it 'returns the method name' do
|
67
|
-
matcher.method_name.should == :eq
|
68
|
-
end
|
28
|
+
it 'returns the method name' do
|
29
|
+
matcher.method_name.should == :==
|
69
30
|
end
|
70
31
|
end
|
71
32
|
|
@@ -665,7 +626,7 @@ module Transpec
|
|
665
626
|
<<-END
|
666
627
|
describe 'example' do
|
667
628
|
it 'is 1' do
|
668
|
-
subject.should
|
629
|
+
subject.should ==(1)
|
669
630
|
end
|
670
631
|
end
|
671
632
|
END
|
@@ -681,7 +642,7 @@ module Transpec
|
|
681
642
|
<<-END
|
682
643
|
describe 'example' do
|
683
644
|
it 'is 1' do
|
684
|
-
subject.should
|
645
|
+
subject.should == 1
|
685
646
|
end
|
686
647
|
end
|
687
648
|
END
|
@@ -694,7 +655,7 @@ module Transpec
|
|
694
655
|
<<-END
|
695
656
|
describe 'example' do
|
696
657
|
it 'is 1' do
|
697
|
-
subject.should
|
658
|
+
subject.should ==(1)
|
698
659
|
end
|
699
660
|
end
|
700
661
|
END
|
@@ -712,7 +673,7 @@ module Transpec
|
|
712
673
|
<<-END
|
713
674
|
describe 'example' do
|
714
675
|
it 'is 1' do
|
715
|
-
subject.should
|
676
|
+
subject.should == 1
|
716
677
|
end
|
717
678
|
end
|
718
679
|
END
|
@@ -724,38 +685,12 @@ module Transpec
|
|
724
685
|
end
|
725
686
|
end
|
726
687
|
|
727
|
-
context 'when its multiple arguments are not in parentheses' do
|
728
|
-
let(:source) do
|
729
|
-
<<-END
|
730
|
-
describe 'example' do
|
731
|
-
it 'contains 1 and 2' do
|
732
|
-
subject.should include 1, 2
|
733
|
-
end
|
734
|
-
end
|
735
|
-
END
|
736
|
-
end
|
737
|
-
|
738
|
-
let(:expected_source) do
|
739
|
-
<<-END
|
740
|
-
describe 'example' do
|
741
|
-
it 'contains 1 and 2' do
|
742
|
-
subject.should include(1, 2)
|
743
|
-
end
|
744
|
-
end
|
745
|
-
END
|
746
|
-
end
|
747
|
-
|
748
|
-
it 'inserts parentheses' do
|
749
|
-
rewritten_source.should == expected_source
|
750
|
-
end
|
751
|
-
end
|
752
|
-
|
753
688
|
context 'when its argument is a string literal' do
|
754
689
|
let(:source) do
|
755
690
|
<<-END
|
756
691
|
describe 'example' do
|
757
692
|
it "is 'string'" do
|
758
|
-
subject.should
|
693
|
+
subject.should == 'string'
|
759
694
|
end
|
760
695
|
end
|
761
696
|
END
|
@@ -765,7 +700,7 @@ module Transpec
|
|
765
700
|
<<-END
|
766
701
|
describe 'example' do
|
767
702
|
it "is 'string'" do
|
768
|
-
subject.should
|
703
|
+
subject.should ==('string')
|
769
704
|
end
|
770
705
|
end
|
771
706
|
END
|
@@ -781,7 +716,7 @@ module Transpec
|
|
781
716
|
<<-END
|
782
717
|
describe 'example' do
|
783
718
|
it 'returns the document' do
|
784
|
-
subject.should
|
719
|
+
subject.should == <<-HEREDOC
|
785
720
|
foo
|
786
721
|
HEREDOC
|
787
722
|
end
|
@@ -808,7 +743,7 @@ module Transpec
|
|
808
743
|
<<-END
|
809
744
|
describe 'example' do
|
810
745
|
it 'returns the document' do
|
811
|
-
subject.should
|
746
|
+
subject.should == <<-HEREDOC.gsub('foo', 'bar')
|
812
747
|
foo
|
813
748
|
HEREDOC
|
814
749
|
end
|
@@ -838,7 +773,7 @@ module Transpec
|
|
838
773
|
<<-'END'
|
839
774
|
it 'returns the document' do
|
840
775
|
string = 'foo'
|
841
|
-
subject.should
|
776
|
+
subject.should == <<-HEREDOC
|
842
777
|
#{string}
|
843
778
|
HEREDOC
|
844
779
|
end
|
@@ -12,9 +12,203 @@ module Transpec
|
|
12
12
|
include_context 'syntax object', Expect, :expect_object
|
13
13
|
include_context 'syntax object', Allow, :allow_object
|
14
14
|
|
15
|
-
|
16
|
-
let(:record) { receive_object.report.records.last }
|
15
|
+
let(:record) { receive_object.report.records.last }
|
17
16
|
|
17
|
+
describe '#remove_useless_and_return!' do
|
18
|
+
before do
|
19
|
+
receive_object.remove_useless_and_return!
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'with #expect' do
|
23
|
+
let(:receive_object) { expect_object.receive_matcher }
|
24
|
+
|
25
|
+
context 'when it is `expect(obj).to receive(:method).and_return { value }` form' do
|
26
|
+
let(:source) do
|
27
|
+
<<-END
|
28
|
+
describe 'example' do
|
29
|
+
it 'receives #foo and returns 1' do
|
30
|
+
expect(subject).to receive(:foo).and_return { 1 }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
END
|
34
|
+
end
|
35
|
+
|
36
|
+
let(:expected_source) do
|
37
|
+
<<-END
|
38
|
+
describe 'example' do
|
39
|
+
it 'receives #foo and returns 1' do
|
40
|
+
expect(subject).to receive(:foo) { 1 }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
END
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'converts into `expect(obj).to receive(:method) { value }` form' do
|
47
|
+
rewritten_source.should == expected_source
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'adds record `expect(obj).to receive(:message).and_return { value }` ' \
|
51
|
+
'-> `expect(obj).to receive(:message) { value }`' do
|
52
|
+
record.original_syntax.should == 'expect(obj).to receive(:message).and_return { value }'
|
53
|
+
record.converted_syntax.should == 'expect(obj).to receive(:message) { value }'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when it is `expect(obj).to receive(:method).and_return do value end` form' do
|
58
|
+
let(:source) do
|
59
|
+
<<-END
|
60
|
+
describe 'example' do
|
61
|
+
it 'receives #foo and returns 1' do
|
62
|
+
expect(subject).to receive(:foo).and_return do
|
63
|
+
1
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
END
|
68
|
+
end
|
69
|
+
|
70
|
+
let(:expected_source) do
|
71
|
+
<<-END
|
72
|
+
describe 'example' do
|
73
|
+
it 'receives #foo and returns 1' do
|
74
|
+
expect(subject).to receive(:foo) do
|
75
|
+
1
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
END
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'converts into `expect(obj).to receive(:method) do value end` form' do
|
83
|
+
rewritten_source.should == expected_source
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'adds record `expect(obj).to receive(:message).and_return` ' \
|
87
|
+
'-> `expect(obj).to receive(:message)`' do
|
88
|
+
record.original_syntax.should == 'expect(obj).to receive(:message).and_return'
|
89
|
+
record.converted_syntax.should == 'expect(obj).to receive(:message)'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when it is `expect_any_instance_of(Klass).to receive(:method).and_return { value }` form' do
|
94
|
+
let(:source) do
|
95
|
+
<<-END
|
96
|
+
describe 'example' do
|
97
|
+
it 'receives #foo and returns 1' do
|
98
|
+
expect_any_instance_of(Klass).to receive(:foo).and_return { 1 }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
END
|
102
|
+
end
|
103
|
+
|
104
|
+
let(:expected_source) do
|
105
|
+
<<-END
|
106
|
+
describe 'example' do
|
107
|
+
it 'receives #foo and returns 1' do
|
108
|
+
expect_any_instance_of(Klass).to receive(:foo) { 1 }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
END
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'converts into `expect_any_instance_of(Klass).to receive(:method) { value }` form' do
|
115
|
+
rewritten_source.should == expected_source
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'adds record `expect(obj).to receive(:message).and_return` ' \
|
119
|
+
'-> `expect(obj).to receive(:message)`' do
|
120
|
+
record.original_syntax.should == 'expect(obj).to receive(:message).and_return { value }'
|
121
|
+
record.converted_syntax.should == 'expect(obj).to receive(:message) { value }'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'when it is `expect(obj).to receive(:method).and_return` form' do
|
126
|
+
let(:source) do
|
127
|
+
<<-END
|
128
|
+
describe 'example' do
|
129
|
+
it 'responds to #foo' do
|
130
|
+
expect(subject).to receive(:foo).and_return
|
131
|
+
end
|
132
|
+
end
|
133
|
+
END
|
134
|
+
end
|
135
|
+
|
136
|
+
let(:expected_source) do
|
137
|
+
<<-END
|
138
|
+
describe 'example' do
|
139
|
+
it 'responds to #foo' do
|
140
|
+
expect(subject).to receive(:foo)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
END
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'converts into `expect(obj).to receive(:method)` form' do
|
147
|
+
rewritten_source.should == expected_source
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'adds record `expect(obj).to receive(:message).and_return` -> `expect(obj).to receive(:message)`' do
|
151
|
+
record.original_syntax.should == 'expect(obj).to receive(:message).and_return'
|
152
|
+
record.converted_syntax.should == 'expect(obj).to receive(:message)'
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context 'when it is `expect(obj).to receive(:message).and_return(value)` form' do
|
157
|
+
let(:source) do
|
158
|
+
<<-END
|
159
|
+
describe 'example' do
|
160
|
+
it 'responds to #foo and returns 1' do
|
161
|
+
expect(obj).to receive(:message).and_return(1)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
END
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'does nothing' do
|
168
|
+
rewritten_source.should == source
|
169
|
+
record.should be_nil
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'with #allow' do
|
175
|
+
let(:receive_object) { allow_object.receive_matcher }
|
176
|
+
|
177
|
+
context 'when it is `allow(obj).to receive(:method).and_return { value }` form' do
|
178
|
+
let(:source) do
|
179
|
+
<<-END
|
180
|
+
describe 'example' do
|
181
|
+
it 'responds to #foo and returns 1' do
|
182
|
+
allow(subject).to receive(:foo).and_return { 1 }
|
183
|
+
end
|
184
|
+
end
|
185
|
+
END
|
186
|
+
end
|
187
|
+
|
188
|
+
let(:expected_source) do
|
189
|
+
<<-END
|
190
|
+
describe 'example' do
|
191
|
+
it 'responds to #foo and returns 1' do
|
192
|
+
allow(subject).to receive(:foo) { 1 }
|
193
|
+
end
|
194
|
+
end
|
195
|
+
END
|
196
|
+
end
|
197
|
+
|
198
|
+
it 'converts into `allow(obj).to receive(:method) { value }` form' do
|
199
|
+
rewritten_source.should == expected_source
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'adds record `allow(obj).to receive(:message).and_return { value }` ' \
|
203
|
+
'-> `allow(obj).to receive(:message) { value }`' do
|
204
|
+
record.original_syntax.should == 'allow(obj).to receive(:message).and_return { value }'
|
205
|
+
record.converted_syntax.should == 'allow(obj).to receive(:message) { value }'
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#add_receiver_arg_to_any_instance_implementation_block!' do
|
18
212
|
before do
|
19
213
|
receive_object.add_receiver_arg_to_any_instance_implementation_block!
|
20
214
|
end
|
@@ -56,6 +250,41 @@ module Transpec
|
|
56
250
|
end
|
57
251
|
end
|
58
252
|
|
253
|
+
context 'when it is `expect_any_instance_of(Klass).to receive(:method).once do |arg| .. end` form' do
|
254
|
+
let(:source) do
|
255
|
+
<<-END
|
256
|
+
describe 'example' do
|
257
|
+
it 'receives #foo' do
|
258
|
+
expect_any_instance_of(Klass).to receive(:foo).once do |arg|
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
END
|
263
|
+
end
|
264
|
+
|
265
|
+
let(:expected_source) do
|
266
|
+
<<-END
|
267
|
+
describe 'example' do
|
268
|
+
it 'receives #foo' do
|
269
|
+
expect_any_instance_of(Klass).to receive(:foo).once do |instance, arg|
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
END
|
274
|
+
end
|
275
|
+
|
276
|
+
it 'converts into ' \
|
277
|
+
'`expect_any_instance_of(Klass).to receive(:method).once do |instance, arg| .. end` form' do
|
278
|
+
rewritten_source.should == expected_source
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'adds record `expect_any_instance_of(Klass).to receive(:message) { |arg| }` ' \
|
282
|
+
'-> `Klass.any_instance.should_receive(:message) { |instance, arg| }`' do
|
283
|
+
record.original_syntax.should == 'expect_any_instance_of(Klass).to receive(:message) { |arg| }'
|
284
|
+
record.converted_syntax.should == 'expect_any_instance_of(Klass).to receive(:message) { |instance, arg| }'
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
59
288
|
context 'when it is `expect_any_instance_of(Klass).to receive(:method) { |arg| .. }` form' do
|
60
289
|
let(:source) do
|
61
290
|
<<-END
|