I have a Rails spec where I want to check that the action_name is either
"create" or "update". I can think of a couple of ways to do it, but none
of them reads fantastically well:

1. ["create", "update"].should include(controller.action_name)

Problem: The error message, should it fail, is: expected ["create",
"update"] to include "foo"

2. controller.action_name.should match(/^create|update$/)

Problem: Not brilliantly readable, but the error message would be
better.

Is there a better way to do it? Something like this would be cool:

controller.action_name.should == any_of("create", "update")

Jon

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

Reply via email to