Top Level Namespace

Defined Under Namespace

Modules: AttributeExt Classes: SafeAttributesMatcher

Instance Method Summary collapse

Instance Method Details

#have_no_safe_attributesObject

:nodoc:



28
29
30
# File 'lib/attribute_ext/rspec.rb', line 28

def have_no_safe_attributes # :nodoc:
  have_safe_attributes
end

#have_safe_attributes(*attributes) ⇒ Object

Checks if a model has certain safe attributes.

:call-seq: model.should have_safe_attributes(attribute1, attribute2 …).as(role, name).and_as(role2, name2)

model should be an instance of ActiveRecord::Base attribute should be the model attribute name as string or symbol role may be a role identifier name may be a name for role used for description

Examples

user.should have_no_safe_attributes()
user.should have_safe_attributes(:email).as(:self, 'himself')
user.should have_safe_attributes(:login, :email).as(:admin, 'Admin).and_as(:system, 'System')

#as and #and_as can be used equally. #have_no_safe_attributes is an alias for #have_safe_attributes with no parameters.

have_safe_attributes should not be used with should_not.



24
25
26
# File 'lib/attribute_ext/rspec.rb', line 24

def have_safe_attributes(*attributes)
  SafeAttributesMatcher.new(attributes)
end