Permalink
Browse files

Adds lots of pending specs for the adapter

  • Loading branch information...
1 parent d2ab0a4 commit 9559ee3bfd088d6f85c117b379d2f410312bc26b @hassox hassox committed Jul 18, 2008
@@ -28,6 +28,7 @@ spec = Gem::Specification.new do |s|
# Uncomment this to add a dependency
# s.add_dependency "foo"
+ s.add_dependency "rest_client"
s.require_path = 'lib'
s.autorequire = GEM
@@ -1,3 +1,4 @@
require 'dm-core'
+require 'rest_client'
-require File.join(File.dirname(__FILE__), "..", "merb_dm_rest_adapter")
+require File.join(File.dirname(__FILE__), "merb_rest_adapter")
@@ -23,18 +23,31 @@ class Comment
before(:all) do
- DataMapper.setup(:default, "merb_rest://example.com")
- @repository = repository(:default)
+ DataMapper.setup(:default, "sqlite3::memory:")
+ repository(:default).auto_migrate!
+
+ DataMapper.setup(:merb_rest, "merb_rest://example.com")
+ @repository = repository(:merb_rest)
@adapter = @repository.adapter
+
+ 1.upto(10) do |n|
+ Post.create(:title => "title #{n}", :body => "body #{n}")
+ end
end
-
+
it "should handle ssl"
it "should setup an connection"
it "should setup a connection with basic auth"
describe "create" do
it{@adapter.should respond_to(:create)}
- it "should send a post to the Post resource with parameters"
+ it "should send a post to the Post resource with parameters" do
+ pending
+ params = {:post => {:title => "created post", :body => "created_body"}}
+ RestClient.should_receive(:post).with("http://example.com/posts", params.to_params)
+ Post.create(params[:post])
+ end
+
it "should return the number of created items"
it "should return 0 if a post does not save"
end
@@ -1,4 +1,10 @@
-require 'rubygems'
-require 'dm-core'
$TESTING=true
-$:.push File.join(File.dirname(__FILE__), '..', 'lib')
+
+require 'rubygems'
+require 'spec'
+require 'merb-core'
+
+require File.dirname(__FILE__) / ".." / "lib" / "merb-rest-client"
+
+# Spec::Runner.configure do |config|
+# end

0 comments on commit 9559ee3

Please sign in to comment.