On Jul 13, 2008, at 5:03 pm, Sven Fuchs wrote:

Hey Ashley!

How's things? :)

Good thanks, just sadly not spent much time using RSpec lately...

Spam me off list if you want to catch up!


Wow, yes.

This also uses the block passed to should_receive, but in a nicer way than my inital attemp which is a bit chatty.

It'd look a bit odd when I want to specify the order for a bunch of methods, but actually I don't need to do that here.

Again, this really should be documented. I even started digging into the RSpec source, but obviously lacked the creativity for this :)

I remember posting about this a long time ago. I think it was Aslak that replied. I'd prefer a neater syntax for ordered expectations across mocks. Not too long ago I was working on my database migration tool that has to turn a graph of migrations into a linear sequence before it can apply them, and obviously the order is essential. But the specs look something like...

  migration_1.should_receive(:apply) do
    migration_2.should_receive(:apply) do
      migration_3.should_receive(:apply) do
        migration_4.should_receive(:apply) do
          ...

which is a bit hideous.

I'd prefer something like

  migration_1.should_receive(:apply)
migration_2.should_receive(:apply).after(migration_2.receives(:apply))
  ...

but I guess that would complicate the implementation.

As it's a relatively uncommon thing I think probably just documenting it is ok for now.

Ashley


--
http://www.patchspace.co.uk/
http://aviewfromafar.net/

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to