[rspec-users] array_including()

Joseph Wilk lists at ruby-forum.com
Wed Aug 27 12:45:17 EDT 2008


Hello,

I believe Pat Maddox has implemented a matcher that does the same thing 
but there has been a battle to find out what to call it:
http://www.ruby-forum.com/topic/162000#new

However I've not seen it in source yet.

--
Joseph Wilk
http://www.joesniff.co.uk

Matt Wynne wrote:
> I found myself having to write this today:
> 
> class ArrayMatcher
> 
>    def initialize(array_to_match)
>      @array_to_match = array_to_match
>    end
> 
>    def ==(other)
> 
>      ok = true
> 
>      @array_to_match.each do |item|
>        ok = ok and other.include?(item)
>      end
> 
>      ok
> 
>    end
> 
> end
> 
> def array_including(array_to_match)
>    ArrayMatcher.new(array_to_match)
> end
> 
> Is there already something in the framework that does this?
> 
> cheers,
> Matt
> ----
> http://blog.mattwynne.net
> http://songkick.com
> 
> In case you wondered: The opinions expressed in this email are my own
> and do not necessarily reflect the views of any former, current or
> future employers of mine.

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list