rspec/rspec-rails — pull request #605 by woahdae (2012-09-11 20:39:57+00:00)
Title: Support validation contexts when using #errors_on

Previously, Model#errors_on calls Model#valid?, which will both clear
the errors hash and run validations in the default context. This adds an
:on option to #errors_on that gets passed to #valid?, allowing using
errors_on with validation contexts.

Exmaple usage:

class Foo
validates :name, length: {minimum: 20}, on: :publication
end

describe Foo
it 'should have a name greater than 20 characters on publication' do
subject.name = 'too short'
subject.name.should have(1).error_on(:name, on: :publication)
end
end