aidmock 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -22,8 +22,7 @@ h2. Configuration
22
22
 
23
23
  In order to use Aidmock, you need to configure it on your test environment. Since it's only working on RSpec for now you need to configure your @spec_helper@:
24
24
 
25
- bc..
26
- RSpec.configure do |config|
25
+ bc.. RSpec.configure do |config|
27
26
  config.before :all do
28
27
  Aidmock.setup # it will do any nescessary setup, like extending your framework mocks
29
28
  end
@@ -233,10 +232,20 @@ Aidmock.interface Animal do
233
232
  end
234
233
 
235
234
  it "test inheritance" do
236
- dog = Dog.allocate
235
+ dog = mock.constrained_to(Dog)
237
236
  dog.stub(:scream).with("ha").and_return("ha!!!") # this stub will be verified as you expect
238
237
  end
239
238
 
239
+ h2. Changelog
240
+
241
+ h3. 0.2.0
242
+
243
+ * Added .constrained_to to mocks
244
+
245
+ h3. 0.1.0
246
+
247
+ * initial version
248
+
240
249
  h2. Feedback
241
250
 
242
251
  Aidmock still be somekind of experimental project, any feedback will help a lot. Please use github issues for reporting any bug and/or suggestion :)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.1
data/aidmock.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aidmock}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wilker Lucio"]
12
- s.date = %q{2011-01-17}
12
+ s.date = %q{2011-01-24}
13
13
  s.description = %q{Aidmock, safe mocking and interfacing for Ruby}
14
14
  s.email = %q{wilkerlucio@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -23,9 +23,11 @@ Gem::Specification.new do |s|
23
23
  "Rakefile",
24
24
  "VERSION",
25
25
  "aidmock.gemspec",
26
+ "examples/autointerface_spec.rb",
26
27
  "examples/integration_spec.rb",
27
28
  "examples/mock_spec.rb",
28
29
  "lib/aidmock.rb",
30
+ "lib/aidmock/auto_interface.rb",
29
31
  "lib/aidmock/basic_object.rb",
30
32
  "lib/aidmock/errors.rb",
31
33
  "lib/aidmock/frameworks.rb",
@@ -35,6 +37,7 @@ Gem::Specification.new do |s|
35
37
  "lib/aidmock/method_descriptor.rb",
36
38
  "lib/aidmock/sanity.rb",
37
39
  "lib/aidmock/void_class.rb",
40
+ "spec/aidmock/auto_interface_spec.rb",
38
41
  "spec/aidmock/frameworks/rspec_spec.rb",
39
42
  "spec/aidmock/interface_spec.rb",
40
43
  "spec/aidmock/matchers_spec.rb",
@@ -49,13 +52,15 @@ Gem::Specification.new do |s|
49
52
  s.rubygems_version = %q{1.3.7}
50
53
  s.summary = %q{Aidmock, safe mocking and interfacing for Ruby}
51
54
  s.test_files = [
52
- "spec/aidmock/frameworks/rspec_spec.rb",
55
+ "spec/aidmock/auto_interface_spec.rb",
56
+ "spec/aidmock/frameworks/rspec_spec.rb",
53
57
  "spec/aidmock/interface_spec.rb",
54
58
  "spec/aidmock/matchers_spec.rb",
55
59
  "spec/aidmock/method_descriptor_spec.rb",
56
60
  "spec/aidmock/sanity_spec.rb",
57
61
  "spec/aidmock_spec.rb",
58
62
  "spec/spec_helper.rb",
63
+ "examples/autointerface_spec.rb",
59
64
  "examples/integration_spec.rb",
60
65
  "examples/mock_spec.rb"
61
66
  ]
@@ -0,0 +1,42 @@
1
+ $: << File.expand_path("../../lib", __FILE__)
2
+ require 'aidmock'
3
+
4
+ RSpec.configure do |config|
5
+ config.after :each do
6
+ Aidmock.verify
7
+ end
8
+ end
9
+
10
+ class Person
11
+ def self.something(hi)
12
+
13
+ end
14
+
15
+ def first_name
16
+ "first"
17
+ end
18
+
19
+ def last_name
20
+ "last"
21
+ end
22
+
23
+ def full_name
24
+ first_name + " " + last_name
25
+ end
26
+ end
27
+
28
+ Aidmock::Sanity.sanitize
29
+
30
+ describe Person do
31
+ before :each do
32
+ @person = Person.new
33
+ end
34
+
35
+ context ".first_name" do
36
+ it "should return some" do
37
+ @person.stub(:first_name).and_return("f")
38
+ @person.stub(:last_name).and_return("l")
39
+ @person.full_name.should == "f l"
40
+ end
41
+ end
42
+ end
@@ -11,6 +11,8 @@ RSpec.configure do |config|
11
11
  end
12
12
  end
13
13
 
14
+ Aidmock.autointerface = false
15
+
14
16
  class Address
15
17
  def full_address
16
18
  "testing"
@@ -7,6 +7,8 @@ RSpec.configure do |config|
7
7
  end
8
8
  end
9
9
 
10
+ Aidmock.autointerface = false
11
+
10
12
  class Person
11
13
  def self.something(hi)
12
14
 
data/lib/aidmock.rb CHANGED
@@ -22,17 +22,18 @@ require 'aidmock/errors'
22
22
  require 'aidmock/basic_object' unless Kernel.const_defined? :BasicObject
23
23
 
24
24
  module Aidmock
25
+ autoload :AutoInterface, 'aidmock/auto_interface'
25
26
  autoload :Interface, 'aidmock/interface'
26
27
  autoload :MethodDescriptor, 'aidmock/method_descriptor'
27
28
  autoload :VoidClass, 'aidmock/void_class'
28
29
  autoload :Frameworks, 'aidmock/frameworks'
29
- autoload :TestFrameworks, 'aidmock/test_frameworks'
30
30
  autoload :Matchers, 'aidmock/matchers'
31
31
  autoload :Sanity, 'aidmock/sanity'
32
32
 
33
33
  class << self
34
- attr_accessor :warn_undefined_interface
34
+ attr_accessor :warn_undefined_interface, :autointerface
35
35
  alias :warn_undefined_interface? :warn_undefined_interface
36
+ alias :autointerface? :autointerface
36
37
 
37
38
  def interface(klass, &block)
38
39
  interfaces[klass] = create_or_update_interface(klass, &block)
@@ -51,6 +52,10 @@ module Aidmock
51
52
  @interfaces ||= {}
52
53
  end
53
54
 
55
+ def has_interface?(klass)
56
+ interfaces[klass] ? true : false
57
+ end
58
+
54
59
  def framework
55
60
  ::Aidmock::Frameworks::RSpec
56
61
  end
@@ -71,6 +76,8 @@ module Aidmock
71
76
 
72
77
  if chain.length > 0
73
78
  verify_double_on_chain(double, chain)
79
+ elsif autointerface?
80
+ AutoInterface.define(klass)
74
81
  else
75
82
  puts "Aidmock Warning: unsafe mocking on class #{klass}, please interface it" if warn_undefined_interface?
76
83
  end
@@ -113,3 +120,4 @@ module Aidmock
113
120
  end
114
121
 
115
122
  Aidmock.warn_undefined_interface = true
123
+ Aidmock.autointerface = true
@@ -0,0 +1,72 @@
1
+ # Copyright (c) 2011 Wilker Lúcio
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module Aidmock
22
+ module AutoInterface
23
+ class << self
24
+ def define(klass)
25
+ klass.ancestors.each do |k|
26
+ define_interface(k)
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def define_interface(klass)
33
+ return false if Aidmock.has_interface?(klass)
34
+
35
+ interface = initialize_interface(klass)
36
+
37
+ klass_methods(klass).each do |method|
38
+ args = method_arity_arguments(klass.method(method).arity)
39
+ interface.class_method method, nil, *args
40
+ end
41
+
42
+ klass_instance_methods(klass).each do |method|
43
+ args = method_arity_arguments(klass.instance_method(method).arity)
44
+ interface.method method, nil, *args
45
+ end
46
+
47
+ Aidmock.interfaces[klass] = interface
48
+ end
49
+
50
+ def initialize_interface(klass)
51
+ Interface.new(klass)
52
+ end
53
+
54
+ def method_arity_arguments(arity)
55
+ if arity >= 0
56
+ [nil] * arity
57
+ else
58
+ required_arity = arity * -1 - 1
59
+ [nil] * required_arity + [Matchers::SplatArgMatcher.new(nil)]
60
+ end
61
+ end
62
+
63
+ def klass_methods(klass)
64
+ (klass.public_methods(false) + klass.protected_methods(false) + klass.private_methods(false)).map { |m| m.to_sym }
65
+ end
66
+
67
+ def klass_instance_methods(klass)
68
+ (klass.public_instance_methods(false) + klass.protected_instance_methods(false) + klass.private_instance_methods(false)).map { |m| m.to_sym }
69
+ end
70
+ end
71
+ end
72
+ end
@@ -32,6 +32,8 @@ module Aidmock
32
32
  end
33
33
 
34
34
  class AnyMatcher
35
+ attr_reader :matchers
36
+
35
37
  def initialize(*matchers)
36
38
  @matchers = matchers.map { |matcher| ::Aidmock::Matchers.create(matcher) }
37
39
  end
@@ -39,6 +41,10 @@ module Aidmock
39
41
  def match?(object)
40
42
  @matchers.any? { |matcher| matcher.match? object }
41
43
  end
44
+
45
+ def ==(object)
46
+ object.class == AnyMatcher and object.matchers == @matchers
47
+ end
42
48
  end
43
49
 
44
50
  def any_of(*matchers)
@@ -49,6 +55,10 @@ module Aidmock
49
55
  def match?(object)
50
56
  true
51
57
  end
58
+
59
+ def ==(object)
60
+ object.class == AnythingMatcher
61
+ end
52
62
  end
53
63
 
54
64
  def anything
@@ -56,6 +66,8 @@ module Aidmock
56
66
  end
57
67
 
58
68
  class DuckTypeMatcher
69
+ attr_reader :methods
70
+
59
71
  def initialize(*methods)
60
72
  @methods = methods
61
73
  end
@@ -64,6 +76,10 @@ module Aidmock
64
76
  return true if object.nil?
65
77
  @methods.all? { |method| object.respond_to? method }
66
78
  end
79
+
80
+ def ==(object)
81
+ object.class == DuckTypeMatcher and object.methods == @methods
82
+ end
67
83
  end
68
84
 
69
85
  def respond_to(*methods)
@@ -71,6 +87,8 @@ module Aidmock
71
87
  end
72
88
 
73
89
  class InstanceOfMatcher
90
+ attr_reader :klass
91
+
74
92
  def initialize(klass)
75
93
  @klass = klass
76
94
  end
@@ -79,6 +97,10 @@ module Aidmock
79
97
  return true if object.nil?
80
98
  object.instance_of? @klass
81
99
  end
100
+
101
+ def ==(object)
102
+ object.class == InstanceOfMatcher and object.klass == @klass
103
+ end
82
104
  end
83
105
 
84
106
  def instance_of(klass)
@@ -86,6 +108,8 @@ module Aidmock
86
108
  end
87
109
 
88
110
  class KindOfMatcher
111
+ attr_reader :klass
112
+
89
113
  def initialize(klass)
90
114
  @klass = klass
91
115
  end
@@ -94,6 +118,10 @@ module Aidmock
94
118
  return true if object.nil?
95
119
  object.kind_of? @klass
96
120
  end
121
+
122
+ def ==(object)
123
+ object.class == KindOfMatcher and object.klass == @klass
124
+ end
97
125
  end
98
126
 
99
127
  def kind_of(klass)
@@ -101,6 +129,8 @@ module Aidmock
101
129
  end
102
130
 
103
131
  class HashMatcher
132
+ attr_reader :hash, :strict
133
+
104
134
  def initialize(check_hash, strict = false)
105
135
  @hash = {}
106
136
  @strict = strict
@@ -123,6 +153,10 @@ module Aidmock
123
153
 
124
154
  true
125
155
  end
156
+
157
+ def ==(object)
158
+ object.class == HashMatcher and object.hash == @hash and object.strict == @strict
159
+ end
126
160
  end
127
161
 
128
162
  def hash_including(hash, strict = false)
@@ -130,6 +164,8 @@ module Aidmock
130
164
  end
131
165
 
132
166
  class NotNilArgMatcher
167
+ attr_reader :matcher
168
+
133
169
  def initialize(matcher)
134
170
  @matcher = ::Aidmock::Matchers.create(matcher)
135
171
  end
@@ -138,6 +174,10 @@ module Aidmock
138
174
  return false if object.nil?
139
175
  @matcher.match? object
140
176
  end
177
+
178
+ def ==(object)
179
+ object.class == NotNilArgMatcher and object.matcher == @matcher
180
+ end
141
181
  end
142
182
 
143
183
  def not_nil(value)
@@ -147,6 +187,8 @@ module Aidmock
147
187
  alias_method :nn, :not_nil
148
188
 
149
189
  class OptionalArgMatcher
190
+ attr_reader :matcher
191
+
150
192
  def initialize(matcher)
151
193
  @matcher = ::Aidmock::Matchers.create(matcher)
152
194
  end
@@ -154,6 +196,10 @@ module Aidmock
154
196
  def match?(object)
155
197
  @matcher.match? object
156
198
  end
199
+
200
+ def ==(object)
201
+ object.class == OptionalArgMatcher and object.matcher == @matcher
202
+ end
157
203
  end
158
204
 
159
205
  def optional(value)
@@ -163,6 +209,8 @@ module Aidmock
163
209
  alias_method :o, :optional
164
210
 
165
211
  class SplatArgMatcher
212
+ attr_reader :matcher
213
+
166
214
  def initialize(matcher = nil)
167
215
  @matcher = ::Aidmock::Matchers.create(matcher)
168
216
  end
@@ -170,6 +218,10 @@ module Aidmock
170
218
  def match?(values)
171
219
  values.all? { |value| @matcher.match? value }
172
220
  end
221
+
222
+ def ==(other)
223
+ other.class == SplatArgMatcher and other.matcher == @matcher
224
+ end
173
225
  end
174
226
 
175
227
  def splat(value)
@@ -0,0 +1,109 @@
1
+ # Copyright (c) 2011 Wilker Lúcio
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require File.expand_path("../../spec_helper", __FILE__)
22
+
23
+ class AidmockAutoInterfaceSample
24
+ class << self
25
+ def pb_method; end
26
+ protected
27
+ def pr_method; end
28
+ private
29
+ def pv_method; end
30
+ end
31
+
32
+ def ipb_method(arg); end
33
+ protected
34
+ def ipr_method(arg, *args); end
35
+ private
36
+ def ipv_method(*args); end
37
+ end
38
+
39
+ describe Aidmock::AutoInterface do
40
+ context ".define" do
41
+ it "define interface for each class on ancestors chain" do
42
+ m1 = mock
43
+ m2 = mock
44
+
45
+ k = mock
46
+ k.stub!(:ancestors) { [m1, m2] }
47
+
48
+ Aidmock::AutoInterface.should_receive(:define_interface).with(m1)
49
+ Aidmock::AutoInterface.should_receive(:define_interface).with(m2)
50
+
51
+ Aidmock::AutoInterface.define(k)
52
+ end
53
+ end
54
+
55
+ context ".define_inteface" do
56
+ it "return false if the interface is already defined" do
57
+ Aidmock.stub!(:has_interface?).with(String) { true }
58
+
59
+ Aidmock::AutoInterface.send(:define_interface, String).should be_false
60
+ end
61
+
62
+ it "define each do klass methods" do
63
+ klass = mock
64
+
65
+ String.stub_chain(:method, :arity) { 0 }
66
+ String.stub_chain(:instance_method, :arity) { 0 }
67
+
68
+ Aidmock::AutoInterface.stub!(:klass_methods) { [:test] }
69
+ Aidmock::AutoInterface.stub!(:klass_instance_methods) { [:test2] }
70
+ Aidmock::AutoInterface.stub!(:initialize_interface) { klass }
71
+ Aidmock::AutoInterface.stub!(:method_arity_arguments) { [] }
72
+
73
+ klass.should_receive(:class_method).with :test, nil
74
+ klass.should_receive(:method).with :test2, nil
75
+
76
+ Aidmock::AutoInterface.send :define_interface, String
77
+ end
78
+ end
79
+
80
+ context ".method_arity_arguments" do
81
+ it "return blank array if arity is 0" do
82
+ Aidmock::AutoInterface.send(:method_arity_arguments, 0).should == []
83
+ end
84
+
85
+ it "return an array of nils with argument numbers if it's positive" do
86
+ Aidmock::AutoInterface.send(:method_arity_arguments, 2).should == [nil, nil]
87
+ end
88
+
89
+ it "return an splat with nil if it's -1" do
90
+ Aidmock::AutoInterface.send(:method_arity_arguments, -1).should == [Aidmock::Matchers::SplatArgMatcher.new(nil)]
91
+ end
92
+
93
+ it "return array with required arguments plus splat if negative value" do
94
+ Aidmock::AutoInterface.send(:method_arity_arguments, -4).should == [nil, nil, nil, Aidmock::Matchers::SplatArgMatcher.new(nil)]
95
+ end
96
+ end
97
+
98
+ context ".klass_method" do
99
+ it "return all class methods" do
100
+ Aidmock::AutoInterface.send(:klass_methods, AidmockAutoInterfaceSample).should include(:pb_method, :pr_method, :pv_method)
101
+ end
102
+ end
103
+
104
+ context ".klass_instance_method" do
105
+ it "return all instance methods" do
106
+ Aidmock::AutoInterface.send(:klass_instance_methods, AidmockAutoInterfaceSample).should include(:ipb_method, :ipr_method, :ipv_method)
107
+ end
108
+ end
109
+ end
@@ -18,6 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require File.expand_path("../../spec_helper", __FILE__)
22
+
21
23
  describe Aidmock::Interface do
22
24
  Interface = Aidmock::Interface
23
25
  MockDescriptor = Aidmock::Frameworks::MockDescriptor
@@ -18,6 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require File.expand_path("../../spec_helper", __FILE__)
22
+
21
23
  describe Aidmock::Matchers do
22
24
  m = ::Aidmock::Matchers
23
25
 
@@ -18,6 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require File.expand_path("../../spec_helper", __FILE__)
22
+
21
23
  describe Aidmock::MethodDescriptor do
22
24
  mock_descriptor = Aidmock::Frameworks::MockDescriptor
23
25
  md = Aidmock::MethodDescriptor
@@ -18,6 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require File.expand_path("../../spec_helper", __FILE__)
22
+
21
23
  describe Aidmock::Sanity do
22
24
  context ".sanitize_interfaces" do
23
25
  it "check each defined interface" do
data/spec/aidmock_spec.rb CHANGED
@@ -18,6 +18,8 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
+ require File.expand_path("../spec_helper", __FILE__)
22
+
21
23
  describe Aidmock do
22
24
  context ".interface" do
23
25
  end
@@ -40,13 +42,42 @@ describe Aidmock do
40
42
  end
41
43
 
42
44
  context ".verify_double" do
43
- it "call to verify chain if the chain has any element" do
44
- double = Aidmock::Frameworks::MockDescriptor.new("object", :to_s, nil, [])
45
+ context "has a chain" do
46
+ it "call to verify chain" do
47
+ double = Aidmock::Frameworks::MockDescriptor.new("object", :to_s, nil, [])
48
+
49
+ Aidmock.stub!(:chain_for).with(String) { [String] }
50
+ Aidmock.should_receive(:verify_double_on_chain).with(double, [String])
51
+
52
+ Aidmock.send :verify_double, double
53
+ end
54
+ end
55
+
56
+ context "don't has a chain" do
57
+ context "autointerace enabled" do
58
+ it "define interface with autointerface" do
59
+ double = Aidmock::Frameworks::MockDescriptor.new("object", :to_s, nil, [])
60
+
61
+ Aidmock.stub!(:autointerface?) { true }
62
+ Aidmock.stub!(:chain_for).with(String) { [] }
63
+ Aidmock::AutoInterface.should_receive(:define).with(String) {}
64
+
65
+ Aidmock.send :verify_double, double
66
+ end
67
+ end
68
+
69
+ context "autointerface disabled" do
70
+ it "don't define autointerface and show a warning" do
71
+ double = Aidmock::Frameworks::MockDescriptor.new("object", :to_s, nil, [])
45
72
 
46
- Aidmock.stub!(:chain_for).with(String) { [String] }
47
- Aidmock.should_receive(:verify_double_on_chain).with(double, [String])
73
+ Aidmock.stub!(:warn_undefined_interface?) { false }
74
+ Aidmock.stub!(:autointerface?) { false }
75
+ Aidmock.stub!(:chain_for).with(String) { [] }
76
+ Aidmock::AutoInterface.should_not_receive(:define).with(String) {}
48
77
 
49
- Aidmock.send :verify_double, double
78
+ Aidmock.send :verify_double, double
79
+ end
80
+ end
50
81
  end
51
82
  end
52
83
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 0
9
- version: 0.2.0
7
+ - 3
8
+ - 1
9
+ version: 0.3.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Wilker Lucio
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-17 00:00:00 -03:00
17
+ date: 2011-01-24 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -34,9 +34,11 @@ files:
34
34
  - Rakefile
35
35
  - VERSION
36
36
  - aidmock.gemspec
37
+ - examples/autointerface_spec.rb
37
38
  - examples/integration_spec.rb
38
39
  - examples/mock_spec.rb
39
40
  - lib/aidmock.rb
41
+ - lib/aidmock/auto_interface.rb
40
42
  - lib/aidmock/basic_object.rb
41
43
  - lib/aidmock/errors.rb
42
44
  - lib/aidmock/frameworks.rb
@@ -46,6 +48,7 @@ files:
46
48
  - lib/aidmock/method_descriptor.rb
47
49
  - lib/aidmock/sanity.rb
48
50
  - lib/aidmock/void_class.rb
51
+ - spec/aidmock/auto_interface_spec.rb
49
52
  - spec/aidmock/frameworks/rspec_spec.rb
50
53
  - spec/aidmock/interface_spec.rb
51
54
  - spec/aidmock/matchers_spec.rb
@@ -86,6 +89,7 @@ signing_key:
86
89
  specification_version: 3
87
90
  summary: Aidmock, safe mocking and interfacing for Ruby
88
91
  test_files:
92
+ - spec/aidmock/auto_interface_spec.rb
89
93
  - spec/aidmock/frameworks/rspec_spec.rb
90
94
  - spec/aidmock/interface_spec.rb
91
95
  - spec/aidmock/matchers_spec.rb
@@ -93,5 +97,6 @@ test_files:
93
97
  - spec/aidmock/sanity_spec.rb
94
98
  - spec/aidmock_spec.rb
95
99
  - spec/spec_helper.rb
100
+ - examples/autointerface_spec.rb
96
101
  - examples/integration_spec.rb
97
102
  - examples/mock_spec.rb