Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:984935
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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.