transpec 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/transpec/syntax.rb +1 -3
- data/lib/transpec/syntax/should_receive.rb +3 -3
- data/lib/transpec/version.rb +1 -1
- data/spec/transpec/syntax/should_receive_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fae62db4ce110f7f0191e98d48623bb2c5c50719
|
4
|
+
data.tar.gz: 32f9bea9a00708e08e86e40e7a0a2f1398dbdcfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9eb3c099c5ee8a52d97d9ee93bff084452c16646cb9d9b617cce5db0d87a97cd72da1999d058445bc0e9b490dfb6d636bd01e287897bca6afc75663251ab52d
|
7
|
+
data.tar.gz: 75e5fbcd92d00d26edce8194da908bc8cd5d42bcbd2dc03e8d9bc4dd259d89e39d39c4135a2b4bbd6e27b70f1faccc52c77764975f9313d33474c4c413431bee
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## Master
|
4
4
|
|
5
|
+
## v0.0.6
|
6
|
+
|
7
|
+
* Fix a bug where `SomeClass.any_instance.should_receive(:message).any_number_of_times` was converted into `expect_any_instance_of(SomeClass).to receive(:message)` unintentionally (now it's converted into `allow_any_instance_of(SomeClass).to receive(:message)`)
|
8
|
+
|
5
9
|
## v0.0.5
|
6
10
|
|
7
11
|
* Support conversion of `any_number_of_times`
|
data/lib/transpec/syntax.rb
CHANGED
@@ -62,7 +62,7 @@ module Transpec
|
|
62
62
|
@node.loc.expression
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
private
|
66
66
|
|
67
67
|
def self.target_receiver_node?(node)
|
68
68
|
false
|
@@ -72,8 +72,6 @@ module Transpec
|
|
72
72
|
[]
|
73
73
|
end
|
74
74
|
|
75
|
-
private
|
76
|
-
|
77
75
|
def remove(range)
|
78
76
|
@source_rewriter.remove(range)
|
79
77
|
end
|
@@ -40,7 +40,7 @@ module Transpec
|
|
40
40
|
end
|
41
41
|
|
42
42
|
if any_instance?
|
43
|
-
|
43
|
+
wrap_class_with_any_instance_of!(syntax)
|
44
44
|
else
|
45
45
|
wrap_subject_with_method!(syntax)
|
46
46
|
end
|
@@ -69,8 +69,8 @@ module Transpec
|
|
69
69
|
[:should_receive, :should_not_receive]
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
73
|
-
insert_before(subject_range,
|
72
|
+
def wrap_class_with_any_instance_of!(syntax)
|
73
|
+
insert_before(subject_range, "#{syntax}_any_instance_of(")
|
74
74
|
map = subject_node.loc
|
75
75
|
dot_any_instance_range = map.dot.join(map.selector)
|
76
76
|
replace(dot_any_instance_range, ')')
|
data/lib/transpec/version.rb
CHANGED
@@ -347,6 +347,29 @@ module Transpec
|
|
347
347
|
end
|
348
348
|
end
|
349
349
|
|
350
|
+
context 'when it is `SomeClass.any_instance.should_receive(:method).any_number_of_times` form' do
|
351
|
+
let(:source) do
|
352
|
+
<<-END
|
353
|
+
it 'responds to #foo' do
|
354
|
+
SomeClass.any_instance.should_receive(:foo).any_number_of_times
|
355
|
+
end
|
356
|
+
END
|
357
|
+
end
|
358
|
+
|
359
|
+
let(:expected_source) do
|
360
|
+
<<-END
|
361
|
+
it 'responds to #foo' do
|
362
|
+
allow_any_instance_of(SomeClass).to receive(:foo)
|
363
|
+
end
|
364
|
+
END
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'converts into `allow_any_instance_of(subject).to receive(:method)` form' do
|
368
|
+
should_receive_object.allowize_any_number_of_times!
|
369
|
+
rewritten_source.should == expected_source
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
350
373
|
context 'when it is `subject.should_receive(:method)` form' do
|
351
374
|
let(:source) do
|
352
375
|
<<-END
|
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: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|