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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9855e40cab5a33c95ac0c45e62ba2c8a166d1176
4
- data.tar.gz: 1984df95dd4b3c84eedf68b93096f5b28b63ae83
3
+ metadata.gz: fae62db4ce110f7f0191e98d48623bb2c5c50719
4
+ data.tar.gz: 32f9bea9a00708e08e86e40e7a0a2f1398dbdcfd
5
5
  SHA512:
6
- metadata.gz: 888b7c747f4f36905ebd892b72f391de1d25afa26b22b00c61d74634afdf88ab4ef70c90204d47412c896839d07f34ed3e0f9f9187e6e0e24d073f0529cf2969
7
- data.tar.gz: 7d6df84751dcae9b33ec2f9a755207b22e7e0eaa99993d01e46fac69643dd278954b3dbc6f0aa02055a673a7011342f94b158ba26bf91b430beecaa48393ad27
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`
@@ -62,7 +62,7 @@ module Transpec
62
62
  @node.loc.expression
63
63
  end
64
64
 
65
- protected
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
- wrap_class_in_expect_any_instance_of!
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 wrap_class_in_expect_any_instance_of!
73
- insert_before(subject_range, 'expect_any_instance_of(')
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, ')')
@@ -5,7 +5,7 @@ module Transpec
5
5
  module Version
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 5
8
+ PATCH = 6
9
9
 
10
10
  def self.to_s
11
11
  [MAJOR, MINOR, PATCH].join('.')
@@ -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.5
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-02 00:00:00.000000000 Z
11
+ date: 2013-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser