Module: ActiveSpec::Satisfies::ClassMethods
- Defined in:
- lib/active_spec/satisfies.rb
Instance Method Summary collapse
-
#must_satisfy(spec_name, opts = {}) ⇒ Object
Specifies a specification class (can be anything that responds to
satisfied_by?
) that any instances of the class should satisfy.
Instance Method Details
#must_satisfy(spec_name, opts = {}) ⇒ Object
Specifies a specification class (can be anything that responds to satisfied_by?
) that any instances of the class should satisfy. Takes one option:
-
:if
- used to pass in a block that must return true for the specification to apply. Can be used to conditionally declare specifications.
40 41 42 43 44 |
# File 'lib/active_spec/satisfies.rb', line 40 def must_satisfy(spec_name, opts={}) satisfies = read_inheritable_attribute(:satisfies) || [] satisfies << {:spec => spec_name, :options => opts} write_inheritable_attribute(:satisfies, satisfies) end |