Skip to content

@justinko /gist:984935
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
module RSpec
module Mocks
module AnyInstance
class Chains < Array
def add(chain)
push(chain)
chain
end
def method_names
map {|chain| chain.method_name }
end
def unplayed
reject {|chain| chain.played? }
end
def expectations
chain { select {|chain| chain.is_a?(Expectation) } }
end
def find_with_siblings(chain)
chain { select {|c| c.method_name == chain.method_name } }
end
def find_by_id(id)
find {|chain| chain.object_id == id }
end
def has_playable_messages(args)
reject {|chain| chain.any_unplayable_messages?(args) }
end
private
def chain
self.class.new yield
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.