lib/zendesk2/client/mock.rb in zendesk2-1.7.0 vs lib/zendesk2/client/mock.rb in zendesk2-1.7.1
- old
+ new
@@ -3,11 +3,11 @@
attr_reader :username, :url, :token, :jwt_token
attr_accessor :last_request
def self.data
- @data ||= {
+ @data ||= Hash.new { |h,k| h[k] = {
:categories => {},
:forums => {},
:groups => {},
:help_center_articles => {},
:help_center_categories => {},
@@ -24,15 +24,28 @@
:topics => {},
:user_fields => {},
:users => {},
:views => {},
}
+ }
end
def self.serial_id
@current_id ||= 0
@current_id += 1
@current_id
+ end
+
+ def data
+ self.class.data[@url]
+ end
+
+ def reset
+ data.clear
+ end
+
+ def self.reset
+ data.clear
end
def serial_id
self.class.serial_id
end