module Shoulda::Matchers::ActiveModel

def allow_mass_assignment_of(value)


it { should allow_mass_assignment_of(:first_name).as(:admin) }

In Rails 3.1 you can check role as well:

it { should allow_mass_assignment_of(:first_name) }
it { should_not allow_mass_assignment_of(:password) }

Ensures that the attribute can be set on mass update.
def allow_mass_assignment_of(value)
  AllowMassAssignmentOfMatcher.new(value)
end