Skip to content

Instantly share code, notes, and snippets.

@jxson
Forked from pairing/active_model_lint.rb
Created November 6, 2010 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jxson/665629 to your computer and use it in GitHub Desktop.
Save jxson/665629 to your computer and use it in GitHub Desktop.
# adapted from rspec-rails http://github.com/rspec/rspec-rails/blob/master/spec/rspec/rails/mocks/mock_model_spec.rb
shared_examples_for "ActiveModel" do
require 'test/unit/assertions'
require 'active_model/lint'
include Test::Unit::Assertions
include ActiveModel::Lint::Tests
# to_s is to support ruby-1.9
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
example m.gsub('_',' ') do
send m
end
end
def model
subject
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment