lib/acfs/stub.rb in acfs-1.4.0 vs lib/acfs/stub.rb in acfs-1.5.0
- old
+ new
@@ -14,11 +14,11 @@
@opts = opts
@opts[:with].stringify_keys! if @opts[:with].is_a? Hash
@opts[:return].stringify_keys! if @opts[:return].is_a? Hash
- if @opts[:return].is_a? Array
+ if @opts[:return].is_a?(Array) # rubocop:disable Style/GuardClause
@opts[:return].map! {|h| h.stringify_keys! if h.is_a? Hash }
end
end
def accept?(op)
@@ -51,12 +51,11 @@
def calls
@calls ||= []
end
def called?(count = nil)
- if count.respond_to? :count
- count = count.count
- end # For `5.times` Enumerators
+ count = count.count if count.respond_to?(:count)
+
count.nil? ? calls.any? : calls.size == count
end
def call(op)
calls << op