Sha256: cd66426c58a8c21cdab827ffd896336c8eabc2ca9ce0a0d7e4aec02a79a4dff2

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'spec/test/unit'
require 'active_support/core_ext/object/blank'  # needed by active_model/lint
require 'active_model/lint'
require 'active_support/core_ext/string'

# This must be kept in sync with active_model/lint tests
# at least for as long as
#
#   http://rspec.lighthouseapp.com/projects/5645/tickets/900
#
# isn't resolved in some way (probably with rspec2)

share_examples_for 'an active_model compliant object' do

  include ActiveModel::Lint::Tests

  it 'must implement the #to_key interface' do
    test_to_key
  end

  it 'must implement the #to_param interface' do
    test_to_param
  end

  it 'must implement the #to_partial_path interface' do
    test_to_partial_path if respond_to?(:test_to_partial_path)
  end

  it 'must implement the #valid? interface' do
    test_valid? if respond_to?(:test_valid?)
  end

  it 'must implement the #persisted? interface' do
    test_persisted?
  end

  it 'must implement the .model_name interface' do
    test_model_naming
  end

  it 'must implement the #errors interface' do
    test_errors_aref
    test_errors_full_messages if respond_to?(:test_errors_full_messages)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tpitale-dm-active_model-1.3.0 spec/amo_interface_compliance_spec.rb