Sha256: ddb8fca424aa7a1d6911ebaa7817550c82ae4dbaeb55be26c66f50a895bcf29d
Contents?: true
Size: 812 Bytes
Versions: 1
Compression:
Stored size: 812 Bytes
Contents
require 'smart_rspec/support/assertions' module SmartRspec::Macros include SmartRspec::Support::Assertions def belongs_to(*associations) assert_association :belongs_to, associations end def has_attributes(*attrs) options = attrs.last.is_a?(Hash) && attrs.last.has_key?(:type) ? attrs.pop : nil assert_has_attributes(attrs, options) end def has_one(*associations) assert_association :has_one, associations end def has_many(*associations) assert_association :has_many, associations end def fails_validation_of(*attrs, validations) attrs.each do |attr| context attr do validations.keys.each do |key| validation = validations[key] validation && send("validates_#{key}_of", attr, validation) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smart_rspec-0.0.1 | lib/smart_rspec/macros.rb |