Use the differ to print diffs when args are mismatched between expectations and calls

Related #434. This uses the differ that is now in RSpec support to
perform argument diffing when arguments don't match.

Things worth noting/still to do:

* Special case behaviour needs to be added for the no arguments matcher
  and the any arguments matcher, at the moment something like this:
```
       @@ -1,2 +1,2 @@
       -[#<RSpec::Mocks::ArgumentMatchers::NoArgsMatcher:0x000001024ec728>]
       +[{:bees=>:foo}]
```
  gets printed, and that's obviously not great.
* Need to work out what to do in the "similar args" case where there are
  potentially multiple calls. I think the best thing to do would be to
  would be to only diff if there's one call. (@myronmarston maybe has thoughts?)

There's some refactoring that could be done here but I want to finish
implementing the "similar args" implementation before I do that so that
I'm sure that I'm refactoring the right thing.

Also: needs more specs.
Yes, I think they should consistently use 'is_a_matcher?'. I think the problem you pointed out is #685.

Sent from my iPhone

> On Aug 30, 2014, at 12:59 AM, Sam Phippen <notifications@github.com> wrote:
> 
> In lib/rspec/mocks/error_generator.rb:
> 
> > @@ -187,6 +194,25 @@ def self.raise_double_negation_error(wrapped_expression)
> >  
> >        private
> >  
> > +      def unexpected_arguments_message(expected_args_string, actual_args_string)
> > +        "with unexpected arguments\n  expected: #{expected_args_string}\n       got: #{actual_args_string}"
> > +      end
> > +
> > +      def diff_message(expected_args, actual_args)
> > +        formatted_expected_args = expected_args.map do |x|
> > +          if RSpec::Support.is_a_matcher?(x)
> @myronmarston the suggested behaviour is inconsistent with the expected/got formatting
> 
> For example if we have a spec which reads like this:
> 
> d = double
> collab = Object.new.tap {|o| allow(o).to receive(:description).and_return("This string") }
> expect(d).to receive(:foo).with(collab)
> d.foo([])
> we get this failure message:
> 
>      Failure/Error: d.foo([])
>        Double received :foo with unexpected arguments
>          expected: (This string)
>               got: ([])
>        @@ -1,2 +1,2 @@
>        -[#<Object:0x00000101ac2158>]
>        +[[]]
> I think that we should implement this consistently, so either we should check respond_to? description, or we should check is a matcher, but clearly this isn't what's happening at the moment.
> 
> I'm in favour of replacing the check in the current "expected:" output to use is_a_matcher? too. Thoughts?
> 
> —
> Reply to this email directly or view it on GitHub.