surrogate 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,6 @@ class Surrogate
10
10
 
11
11
  def initialize(actual, surrogate)
12
12
  unless surrogate.instance_variable_get(:@hatchery).kind_of?(Hatchery) && surrogate.instance_variable_get(:@hatchling).kind_of?(Hatchling)
13
- Kernel.warn "You said #{actual} should substitute for #{surrogate}`, but as of 0.6.2, this should be asserted in the other direction."
14
13
  surrogate, actual = actual, surrogate
15
14
  end
16
15
  self.surrogate, self.actual = surrogate, actual
@@ -23,6 +23,10 @@ class Surrogate
23
23
  end
24
24
 
25
25
  module Matchers
26
+ def be_substitutable_for(original_class, options={})
27
+ SubstitutionMatcher.new original_class, options
28
+ end
29
+
26
30
  def substitute_for(original_class, options={})
27
31
  SubstitutionMatcher.new original_class, options
28
32
  end
@@ -1,3 +1,3 @@
1
1
  class Surrogate
2
- VERSION = "0.6.4"
2
+ VERSION = "0.6.5"
3
3
  end
@@ -1,19 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'substitute_for' do
4
- context 'understands that the non-surrogate class should substitute for the surrogate class when' do
5
- specify 'the surrogate class comes first (but it does emit a warning)' do
6
- Kernel.should_receive(:warn).twice.with kind_of String
3
+ describe 'substutability matchers' do
4
+ context 'understand that the non-surrogate class should substitute for the surrogate class when' do
5
+ specify 'the surrogate class comes first' do
7
6
  surrogate = Surrogate.endow(Class.new).define(:some_meth)
8
7
  surrogate.should_not substitute_for Class.new
8
+ surrogate.should_not be_substitutable_for Class.new
9
9
  surrogate.should substitute_for Class.new { def some_meth() end }
10
+ surrogate.should be_substitutable_for Class.new { def some_meth() end }
10
11
  end
11
12
 
12
- it 'the non-surrogate class comes first (and it does not emit a warning)' do
13
+ it 'the non-surrogate class comes first' do
13
14
  Kernel.should_not_receive :warn
14
15
  surrogate = Surrogate.endow(Class.new).define(:some_meth)
15
16
  Class.new.should_not substitute_for surrogate
17
+ Class.new.should_not be_substitutable_for surrogate
16
18
  Class.new { def some_meth() end }.should substitute_for surrogate
19
+ Class.new { def some_meth() end }.should be_substitutable_for surrogate
17
20
  end
18
21
  end
19
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surrogate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000 Z
12
+ date: 2012-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70270737052860 !ruby/object:Gem::Requirement
16
+ requirement: &70276370003140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70270737052860
24
+ version_requirements: *70276370003140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70270737052300 !ruby/object:Gem::Requirement
27
+ requirement: &70276370002580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.4'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70270737052300
35
+ version_requirements: *70276370002580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mountain_berry_fields
38
- requirement: &70270737051720 !ruby/object:Gem::Requirement
38
+ requirement: &70276370002000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.3
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70270737051720
46
+ version_requirements: *70276370002000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mountain_berry_fields-rspec
49
- requirement: &70270737051180 !ruby/object:Gem::Requirement
49
+ requirement: &70276370001440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.3
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70270737051180
57
+ version_requirements: *70276370001440
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mountain_berry_fields-magic_comments
60
- requirement: &70270737050560 !ruby/object:Gem::Requirement
60
+ requirement: &70276370000820 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 1.0.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70270737050560
68
+ version_requirements: *70276370000820
69
69
  description: Framework to aid in handrolling mock/spy objects.
70
70
  email:
71
71
  - josh.cheek@gmail.com