Add CouchRest::Model::Base.respond_to_missing? and respond_to?

This commit is contained in:
Kim Burgestrand 2011-07-31 04:40:31 +02:00
parent 80e5ed2767
commit 72e3ac37d6
2 changed files with 31 additions and 1 deletions

View file

@ -173,7 +173,22 @@ describe CouchRest::Model::Views do
end
end
describe "#method_missing for find_by methods" do
before(:all) { reset_test_db! }
specify { Course.should respond_to :find_by_title_and_active }
specify { Course.should respond_to :by_title }
specify "#method should work in ruby 1.9, but not 1.8" do
if RUBY_VERSION >= "1.9"
Course.method(:find_by_title_and_active).should be_a Method
else
expect { Course.method(:find_by_title_and_active) }.to raise_error(NameError)
end
end
end
describe "a ducktype view" do
before(:all) do
reset_test_db!