Sha256: 0f1cb2d5b4fd14a3b5fc3a98197e6f8357f96e2d5016a808ae55477274c2b8a5

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

class Test::Unit::TestCase
  ##
  # Asserts that the passed list of fields are specified in the whorm_fields call
  # in the model class.
  # @fieldset {Symbol} fieldset (optional, set to :default if missing)
  # @options {Hash} Should contain a :fields key with an array of fields to check for
  #
  def self.should_have_whorm_fields_for_fieldset fieldset = :default, fields = []
    klass = described_type
    should "have the correct extjs_fields" do
      assert !fields.empty?, "an array of fields must be passed.  Example: (:fieldset_name, [:name, :id])"
      fields.each do |field|
        found_record = klass.whorm_get_fields_for_fieldset(fieldset).find do|record_field|
          record_field[:name].to_sym == field.to_sym
        end
        assert_not_nil found_record, "whorm field #{field} isn't listed in the #{klass.name} model"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sencha-model-0.6.2 shoulda_macros/macros.rb
sencha-model-0.6.1 shoulda_macros/macros.rb
sencha-model-0.6.0 shoulda_macros/macros.rb
sencha-model-0.5.0 shoulda_macros/macros.rb