Module: HasMarkup::Shoulda

Included in:
Test::Unit::TestCase
Defined in:
lib/has_markup/shoulda.rb

Overview

Shoulda macros for has_markup. These get added to Test::Unit::TestCase.

Instance Method Summary collapse

Instance Method Details

#should_cache_markup(column) ⇒ Object

Ensure that markup is cached.

should_cache_markup :content


9
10
11
12
13
# File 'lib/has_markup/shoulda.rb', line 9

def should_cache_markup(column)
  should_have_db_column "cached_#{column}_html"
  should_have_instance_methods "set_cached_#{column}_html"
  # TODO test that there's before_save action happening
end

#should_have_markup(column, options = {}) ⇒ Object

Ensure that the model has markup. Accepts all the same options that has_markup does.

should_have_markup :content


25
26
27
28
29
30
31
32
# File 'lib/has_markup/shoulda.rb', line 25

def should_have_markup(column, options = {})
  options = HasMarkup::default_has_markup_options.merge(options)
  should_have_instance_methods "#{column}_html"

  should_require_markup column if options[:required]

  should_cache_markup column if options[:cache_html]
end

#should_require_markup(column) ⇒ Object

Ensure that markup is required.

should_require_markup :content


18
19
20
# File 'lib/has_markup/shoulda.rb', line 18

def should_require_markup(column)
  should_require_attributes column
end