thoughtbot/shoulda-matchers — pull request #126 by dlnichols (2012-07-02 16:07:49+00:00)
Title: Added role to the description, failure, and negative failure strings

This change only applies when roles are used (roles require rails > 3.1)

Since I use multiple roles in my app, I get output like this:

(success)
Model#uses
should allow mass assignment of uses
should not allow mass assignment of uses
should not allow mass assignment of uses
should not allow mass assignment of uses
should not allow mass assignment of uses

(failure)
1) Model#uses it allows access to attribute
Failure/Error: it { should allow_mass_assignment_of(attribute).as(role) }
Expected uses to be accessible
Shared Example Group: "access to attribute" called from ...

Which was unclear as to which role each test was applicable to. This patch adds the role to various strings to clarify things:

(success)
Model#uses
should allow mass assignment of uses for :admin role
should not allow mass assignment of uses for :premium role
should not allow mass assignment of uses for :user role
should not allow mass assignment of uses for :guest role
should not allow mass assignment of uses

(failure)
1) Model#uses it allows access to attribute
Failure/Error: it { should allow_mass_assignment_of(attribute).as(role) }
Expected uses to be accessible to :user role
Shared Example Group: "access to attribute" called from ...