micro_mock 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/micro_mock/version.rb +1 -1
- data/lib/micro_mock.rb +17 -2
- metadata +1 -1
data/lib/micro_mock/version.rb
CHANGED
data/lib/micro_mock.rb
CHANGED
@@ -62,10 +62,25 @@ module MicroMock
|
|
62
62
|
|
63
63
|
# Defines a mock class.
|
64
64
|
def self.make(superclass=nil)
|
65
|
-
|
66
|
-
|
65
|
+
if superclass
|
66
|
+
klass = Class.new(superclass) do
|
67
|
+
def initialize(*args)
|
68
|
+
@args = args
|
69
|
+
super
|
70
|
+
end
|
71
|
+
end
|
72
|
+
else
|
73
|
+
klass = Class.new do
|
74
|
+
def initialize(*args)
|
75
|
+
@args = args
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
67
79
|
klass.extend MicroMock
|
68
80
|
klass.send :include, MicroMock
|
81
|
+
def klass.initialize(*args)
|
82
|
+
super
|
83
|
+
end
|
69
84
|
Object.const_set "MicroMock#{klass.object_id}", klass
|
70
85
|
klass
|
71
86
|
end
|