Permalink
Browse files

Add a #valid? method for ActiveModel compliance.

  • Loading branch information...
1 parent 19e22cb commit ae6921c23bbc242bf0051bb15f60c4435ddacaf9 @elliotcm committed Mar 27, 2010
Showing with 35 additions and 0 deletions.
  1. +12 −0 lib/document/active_model_compliance.rb
  2. +23 −0 spec/document/active_model_compliance_spec.rb
@@ -0,0 +1,12 @@
+module LightMongo
+ module Document
+
+ module ActiveModelCompliance
+ # Replace this with your own validations.
+ def valid?
+ true
+ end
+ end
+
+ end
+end
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + '/../../lib/document/active_model_compliance'
+
+ActiveModelCompliance = LightMongo::Document::ActiveModelCompliance
+
+class ActiveModelComplianceTest
+ include LightMongo::Document::ActiveModelCompliance
+end
+
+describe ActiveModelCompliance do
+ before(:each) do
+ @model = ActiveModelComplianceTest.new
+ end
+
+ describe "#valid?" do
+ it "responds to #valid?" do
+ @model.should respond_to(:valid?)
+ end
+
+ it "always returns true" do
+ @model.valid?.should be_true
+ end
+ end
+end

0 comments on commit ae6921c

Please sign in to comment.