lib/cistern/service.rb in cistern-1.0.1.pre4 vs lib/cistern/service.rb in cistern-1.0.1.pre5
- old
+ new
@@ -71,16 +71,26 @@
include Cistern::Request
def self.inherited(klass)
klass.extend(Cistern::Request::ClassMethods)
- Cistern::Request.service_request(service, klass)
+ name = Cistern::Request.service_request(service, klass)
+
+ service.requests[name.to_sym] = klass
end
def self.service
#{klass.name}
end
+
+ def _mock(*args)
+ mock(*args)
+ end
+
+ def _real(*args)
+ real(*args)
+ end
end
EOS
klass.send(:const_set, :Timeout, Class.new(Cistern::Error))
@@ -116,11 +126,11 @@
def required_arguments
@required_arguments ||= []
end
def requests
- @requests ||= []
+ @requests ||= {}
end
def requires(*args)
self.required_arguments.concat(args)
end
@@ -128,10 +138,10 @@
def recognizes(*args)
self.recognized_arguments.concat(args)
end
def mocked_requests
- @mocked_requests ||= []
+ @mocked_requests ||= {}
end
def validate_options(options={})
required_options = Cistern::Hash.slice(options, *required_arguments)