samlown-couchrest 0.37.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/README.md +10 -4
  2. data/Rakefile +1 -1
  3. data/history.txt +8 -0
  4. data/lib/couchrest.rb +27 -49
  5. data/lib/couchrest/{core/database.rb → database.rb} +6 -11
  6. data/lib/couchrest/{core/design.rb → design.rb} +2 -2
  7. data/lib/couchrest/{core/document.rb → document.rb} +1 -1
  8. data/lib/couchrest/helper/attachments.rb +29 -0
  9. data/lib/couchrest/middlewares/logger.rb +3 -3
  10. data/lib/couchrest/monkeypatches.rb +1 -71
  11. data/lib/couchrest/{core/response.rb → response.rb} +0 -0
  12. data/lib/couchrest/{core/rest_api.rb → rest_api.rb} +9 -6
  13. data/lib/couchrest/{core/server.rb → server.rb} +0 -0
  14. data/spec/couchrest/{core/couchrest_spec.rb → couchrest_spec.rb} +16 -3
  15. data/spec/couchrest/{core/database_spec.rb → database_spec.rb} +2 -2
  16. data/spec/couchrest/{core/design_spec.rb → design_spec.rb} +2 -2
  17. data/spec/couchrest/{core/document_spec.rb → document_spec.rb} +1 -1
  18. data/spec/couchrest/{core/server_spec.rb → server_spec.rb} +2 -2
  19. data/spec/spec.opts +0 -1
  20. data/spec/spec_helper.rb +0 -4
  21. metadata +24 -113
  22. data/couchrest.gemspec +0 -183
  23. data/examples/model/example.rb +0 -144
  24. data/lib/couchrest/core/adapters/restclient.rb +0 -35
  25. data/lib/couchrest/core/http_abstraction.rb +0 -48
  26. data/lib/couchrest/core/view.rb +0 -4
  27. data/lib/couchrest/mixins.rb +0 -4
  28. data/lib/couchrest/mixins/attachments.rb +0 -31
  29. data/lib/couchrest/mixins/attribute_protection.rb +0 -74
  30. data/lib/couchrest/mixins/callbacks.rb +0 -532
  31. data/lib/couchrest/mixins/class_proxy.rb +0 -124
  32. data/lib/couchrest/mixins/collection.rb +0 -260
  33. data/lib/couchrest/mixins/design_doc.rb +0 -103
  34. data/lib/couchrest/mixins/document_queries.rb +0 -80
  35. data/lib/couchrest/mixins/extended_attachments.rb +0 -70
  36. data/lib/couchrest/mixins/extended_document_mixins.rb +0 -9
  37. data/lib/couchrest/mixins/properties.rb +0 -154
  38. data/lib/couchrest/mixins/validation.rb +0 -246
  39. data/lib/couchrest/mixins/views.rb +0 -173
  40. data/lib/couchrest/more/casted_array.rb +0 -25
  41. data/lib/couchrest/more/casted_model.rb +0 -58
  42. data/lib/couchrest/more/extended_document.rb +0 -310
  43. data/lib/couchrest/more/property.rb +0 -50
  44. data/lib/couchrest/more/typecast.rb +0 -175
  45. data/lib/couchrest/support/blank.rb +0 -42
  46. data/lib/couchrest/support/rails.rb +0 -42
  47. data/lib/couchrest/validation/auto_validate.rb +0 -157
  48. data/lib/couchrest/validation/contextual_validators.rb +0 -78
  49. data/lib/couchrest/validation/validation_errors.rb +0 -125
  50. data/lib/couchrest/validation/validators/absent_field_validator.rb +0 -74
  51. data/lib/couchrest/validation/validators/confirmation_validator.rb +0 -107
  52. data/lib/couchrest/validation/validators/format_validator.rb +0 -122
  53. data/lib/couchrest/validation/validators/formats/email.rb +0 -66
  54. data/lib/couchrest/validation/validators/formats/url.rb +0 -43
  55. data/lib/couchrest/validation/validators/generic_validator.rb +0 -120
  56. data/lib/couchrest/validation/validators/length_validator.rb +0 -139
  57. data/lib/couchrest/validation/validators/method_validator.rb +0 -89
  58. data/lib/couchrest/validation/validators/numeric_validator.rb +0 -109
  59. data/lib/couchrest/validation/validators/required_field_validator.rb +0 -114
  60. data/spec/couchrest/more/attribute_protection_spec.rb +0 -150
  61. data/spec/couchrest/more/casted_extended_doc_spec.rb +0 -79
  62. data/spec/couchrest/more/casted_model_spec.rb +0 -406
  63. data/spec/couchrest/more/extended_doc_attachment_spec.rb +0 -135
  64. data/spec/couchrest/more/extended_doc_inherited_spec.rb +0 -40
  65. data/spec/couchrest/more/extended_doc_spec.rb +0 -808
  66. data/spec/couchrest/more/extended_doc_subclass_spec.rb +0 -98
  67. data/spec/couchrest/more/extended_doc_view_spec.rb +0 -462
  68. data/spec/couchrest/more/property_spec.rb +0 -628
  69. data/spec/fixtures/more/article.rb +0 -35
  70. data/spec/fixtures/more/card.rb +0 -22
  71. data/spec/fixtures/more/cat.rb +0 -20
  72. data/spec/fixtures/more/course.rb +0 -22
  73. data/spec/fixtures/more/event.rb +0 -8
  74. data/spec/fixtures/more/invoice.rb +0 -17
  75. data/spec/fixtures/more/person.rb +0 -9
  76. data/spec/fixtures/more/question.rb +0 -6
  77. data/spec/fixtures/more/service.rb +0 -12
  78. data/spec/fixtures/more/user.rb +0 -22
data/README.md CHANGED
@@ -14,12 +14,17 @@ Note: CouchRest only support CouchDB 0.9.0 or newer.
14
14
 
15
15
  $ sudo gem install couchrest
16
16
 
17
- ### Relax, it's RESTful
17
+ ## Relax, it's RESTful
18
18
 
19
19
  CouchRest rests on top of a HTTP abstraction layer using by default Heroku’s excellent REST Client Ruby HTTP wrapper.
20
- Other adapters can be added to support more http libraries.
21
20
 
22
- ### Running the Specs
21
+ ## Extended Document
22
+
23
+ As of May 2010 support for the popular CouchRest::ExtendedDocument mixin has been moved to its own gem: couchrest_extended_document.
24
+
25
+ Most people will probably want to use this library (or one of the alternatives) to make it slightly easier to access your documents.
26
+
27
+ ## Running the Specs
23
28
 
24
29
  The most complete documentation is the spec/ directory. To validate your
25
30
  CouchRest install, from the project root directory run `rake`, or `autotest`
@@ -38,7 +43,8 @@ Please post bugs, suggestions and patches to the bug tracker at [http://github.c
38
43
  Follow us on Twitter: [http://twitter.com/couchrest](http://twitter.com/couchrest)
39
44
 
40
45
  Also, check [http://twitter.com/#search?q=%23couchrest](http://twitter.com/#search?q=%23couchrest)
41
-
46
+
47
+
42
48
  ## Ruby on Rails
43
49
 
44
50
  CouchRest is compatible with rails and can even be used a Rails plugin.
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ begin
25
25
  gemspec.files = %w( LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec,utils}/**/*"] - Dir["spec/tmp"]
26
26
  gemspec.has_rdoc = true
27
27
  gemspec.add_dependency("rest-client", ">= 0.5")
28
- gemspec.add_dependency("mime-types", ">= 1.15")
28
+ # gemspec.add_dependency("couchrest_extended_document", ">= 1.0.0")
29
29
  gemspec.version = CouchRest::VERSION
30
30
  gemspec.date = "2008-11-22"
31
31
  gemspec.require_path = "lib"
@@ -4,6 +4,14 @@
4
4
 
5
5
  * Minor enhancements
6
6
 
7
+ == 1.0.0
8
+
9
+ * Major enhancements
10
+ * Moved ExtendedDocument and friends into own library, couchrest_extended_document. (Sam Lown)
11
+ * Removed HttpAbstraction component for direct interface with RestClient. (Sam Lown)
12
+ * Changed version to more conventional format starting from 1.0.0 to avoid ambiguity issues with order. (Sam Lown)
13
+
14
+
7
15
  == 0.37
8
16
 
9
17
  * Minor enhancements
@@ -25,31 +25,23 @@ $:.unshift File.dirname(__FILE__) unless
25
25
  $:.include?(File.expand_path(File.dirname(__FILE__)))
26
26
 
27
27
  require 'couchrest/monkeypatches'
28
+ require 'couchrest/rest_api'
28
29
 
29
30
  # = CouchDB, close to the metal
30
31
  module CouchRest
31
- VERSION = '0.37.2' unless self.const_defined?("VERSION")
32
+ VERSION = '1.0.0' unless self.const_defined?("VERSION")
32
33
 
33
- autoload :Server, 'couchrest/core/server'
34
- autoload :Database, 'couchrest/core/database'
35
- autoload :Response, 'couchrest/core/response'
36
- autoload :Document, 'couchrest/core/document'
37
- autoload :Design, 'couchrest/core/design'
38
- autoload :View, 'couchrest/core/view'
39
- autoload :Model, 'couchrest/core/model'
34
+ autoload :Server, 'couchrest/server'
35
+ autoload :Database, 'couchrest/database'
36
+ autoload :Response, 'couchrest/response'
37
+ autoload :Document, 'couchrest/document'
38
+ autoload :Design, 'couchrest/design'
39
+ autoload :Model, 'couchrest/model'
40
40
  autoload :Pager, 'couchrest/helper/pager'
41
- autoload :FileManager, 'couchrest/helper/file_manager'
42
41
  autoload :Streamer, 'couchrest/helper/streamer'
42
+ autoload :Attachments, 'couchrest/helper/attachments'
43
43
  autoload :Upgrade, 'couchrest/helper/upgrade'
44
-
45
- autoload :ExtendedDocument, 'couchrest/more/extended_document'
46
- autoload :CastedModel, 'couchrest/more/casted_model'
47
-
48
- require File.join(File.dirname(__FILE__), 'couchrest', 'core', 'rest_api')
49
- require File.join(File.dirname(__FILE__), 'couchrest', 'core', 'http_abstraction')
50
- require File.join(File.dirname(__FILE__), 'couchrest', 'mixins')
51
- require File.join(File.dirname(__FILE__), 'couchrest', 'support', 'rails') if defined?(Rails)
52
-
44
+
53
45
  # we extend CouchRest with the RestAPI module which gives us acess to
54
46
  # the get, post, put, delete and copy
55
47
  CouchRest.extend(::RestAPI)
@@ -59,35 +51,6 @@ module CouchRest
59
51
  # some helpers for tasks like instantiating a new Database or Server instance.
60
52
  class << self
61
53
 
62
- # extracted from Extlib
63
- #
64
- # Constantize tries to find a declared constant with the name specified
65
- # in the string. It raises a NameError when the name is not in CamelCase
66
- # or is not initialized.
67
- #
68
- # @example
69
- # "Module".constantize #=> Module
70
- # "Class".constantize #=> Class
71
- def constantize(camel_cased_word)
72
- unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ camel_cased_word
73
- raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!"
74
- end
75
-
76
- Object.module_eval("::#{$1}", __FILE__, __LINE__)
77
- end
78
-
79
- # extracted from Extlib
80
- #
81
- # Capitalizes the first word and turns underscores into spaces and strips _id.
82
- # Like titleize, this is meant for creating pretty output.
83
- #
84
- # @example
85
- # "employee_salary" #=> "Employee salary"
86
- # "author_id" #=> "Author"
87
- def humanize(lower_case_and_underscored_word)
88
- lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize
89
- end
90
-
91
54
  # todo, make this parse the url and instantiate a Server or Database instance
92
55
  # depending on the specificity.
93
56
  def new(*opts)
@@ -130,9 +93,9 @@ module CouchRest
130
93
 
131
94
  # set proxy to use
132
95
  def proxy url
133
- HttpAbstraction.proxy = url
96
+ RestClient.proxy = url
134
97
  end
135
-
98
+
136
99
  # ensure that a database exists
137
100
  # creates it if it isn't already there
138
101
  # returns it after it's been created
@@ -160,3 +123,18 @@ module CouchRest
160
123
  end
161
124
  end # class << self
162
125
  end
126
+
127
+ # For the sake of backwards compatability, generate a dummy ExtendedDocument class
128
+ # which should be replaced by real library: couchrest_extended_document.
129
+ #
130
+ # Added 2010-05-10 by Sam Lown. Please remove at some point in the future.
131
+ #
132
+ class CouchRest::ExtendedDocument < CouchRest::Document
133
+
134
+ def self.inherited(subclass)
135
+ raise "ExtendedDocument is no longer included in CouchRest base driver, see couchrest_extended_document gem"
136
+ end
137
+
138
+ end
139
+
140
+
@@ -65,7 +65,7 @@ module CouchRest
65
65
  keys = params.delete(:keys)
66
66
  funcs = funcs.merge({:keys => keys}) if keys
67
67
  url = CouchRest.paramify_url "#{@root}/_temp_view", params
68
- JSON.parse(HttpAbstraction.post(url, funcs.to_json, {"Content-Type" => 'application/json'}))
68
+ JSON.parse(RestClient.post(url, funcs.to_json, {"Content-Type" => 'application/json'}))
69
69
  end
70
70
 
71
71
  # backwards compatibility is a plus
@@ -108,14 +108,14 @@ module CouchRest
108
108
  # GET an attachment directly from CouchDB
109
109
  def fetch_attachment(doc, name)
110
110
  uri = url_for_attachment(doc, name)
111
- HttpAbstraction.get uri
111
+ RestClient.get uri
112
112
  end
113
113
 
114
114
  # PUT an attachment directly to CouchDB
115
115
  def put_attachment(doc, name, file, options = {})
116
116
  docid = escape_docid(doc['_id'])
117
117
  uri = url_for_attachment(doc, name)
118
- JSON.parse(HttpAbstraction.put(uri, file, options))
118
+ JSON.parse(RestClient.put(uri, file, options))
119
119
  end
120
120
 
121
121
  # DELETE an attachment directly from CouchDB
@@ -123,13 +123,13 @@ module CouchRest
123
123
  uri = url_for_attachment(doc, name)
124
124
  # this needs a rev
125
125
  begin
126
- JSON.parse(HttpAbstraction.delete(uri))
126
+ JSON.parse(RestClient.delete(uri))
127
127
  rescue Exception => error
128
128
  if force
129
129
  # get over a 409
130
130
  doc = get(doc['_id'])
131
131
  uri = url_for_attachment(doc, name)
132
- JSON.parse(HttpAbstraction.delete(uri))
132
+ JSON.parse(RestClient.delete(uri))
133
133
  else
134
134
  error
135
135
  end
@@ -174,7 +174,7 @@ module CouchRest
174
174
  uri = "#{@root}/#{slug}"
175
175
  uri << "?batch=ok" if batch
176
176
  CouchRest.put uri, doc
177
- rescue HttpAbstraction::ResourceNotFound
177
+ rescue RestClient::ResourceNotFound
178
178
  p "resource not found when saving even tho an id was passed"
179
179
  slug = doc['_id'] = @server.next_uuid
180
180
  CouchRest.put "#{@root}/#{slug}", doc
@@ -316,7 +316,6 @@ module CouchRest
316
316
  # DELETE the database itself. This is not undoable and could be rather
317
317
  # catastrophic. Use with care!
318
318
  def delete!
319
- clear_extended_doc_fresh_cache
320
319
  CouchRest.delete @root
321
320
  end
322
321
 
@@ -334,10 +333,6 @@ module CouchRest
334
333
  payload[:continuous] = continuous
335
334
  CouchRest.post "#{@host}/_replicate", payload
336
335
  end
337
-
338
- def clear_extended_doc_fresh_cache
339
- ::CouchRest::ExtendedDocument.subclasses.each{|klass| klass.design_doc_fresh = false if klass.respond_to?(:design_doc_fresh=) }
340
- end
341
336
 
342
337
  def uri_for_attachment(doc, name)
343
338
  if doc.is_a?(String)
@@ -67,7 +67,7 @@ JAVASCRIPT
67
67
  def has_view?(view)
68
68
  view = view.to_s
69
69
  self['views'][view] &&
70
- (self['views'][view]["couchrest-defaults"]||{})
70
+ (self['views'][view]["couchrest-defaults"] || {})
71
71
  end
72
72
 
73
73
  def fetch_view view_name, opts, &block
@@ -76,4 +76,4 @@ JAVASCRIPT
76
76
 
77
77
  end
78
78
 
79
- end
79
+ end
@@ -2,7 +2,7 @@ require 'delegate'
2
2
 
3
3
  module CouchRest
4
4
  class Document < Response
5
- include CouchRest::Mixins::Attachments
5
+ include CouchRest::Attachments
6
6
 
7
7
  extlib_inheritable_accessor :database
8
8
  attr_accessor :database
@@ -0,0 +1,29 @@
1
+ module CouchRest
2
+ module Attachments
3
+
4
+ # saves an attachment directly to couchdb
5
+ def put_attachment(name, file, options={})
6
+ raise ArgumentError, "doc must be saved" unless self.rev
7
+ raise ArgumentError, "doc.database required to put_attachment" unless database
8
+ result = database.put_attachment(self, name, file, options)
9
+ self['_rev'] = result['rev']
10
+ result['ok']
11
+ end
12
+
13
+ # returns an attachment's data
14
+ def fetch_attachment(name)
15
+ raise ArgumentError, "doc must be saved" unless self.rev
16
+ raise ArgumentError, "doc.database required to put_attachment" unless database
17
+ database.fetch_attachment(self, name)
18
+ end
19
+
20
+ # deletes an attachment directly from couchdb
21
+ def delete_attachment(name, force=false)
22
+ raise ArgumentError, "doc.database required to delete_attachment" unless database
23
+ result = database.delete_attachment(self, name, force)
24
+ self['_rev'] = result['rev']
25
+ result['ok']
26
+ end
27
+
28
+ end
29
+ end
@@ -53,8 +53,8 @@ module CouchRest
53
53
  end
54
54
  end
55
55
 
56
- # inject our logger into CouchRest HTTP abstraction layer
57
- module HttpAbstraction
56
+ # inject our logger into key RestClient methods
57
+ module RestClient
58
58
 
59
59
  def self.get(uri, headers=nil)
60
60
  start_query = Time.now
@@ -260,4 +260,4 @@ end
260
260
  # end
261
261
  #
262
262
  # end
263
- # end
263
+ # end
@@ -1,5 +1,4 @@
1
1
  require File.join(File.dirname(__FILE__), 'support', 'class')
2
- require File.join(File.dirname(__FILE__), 'support', 'blank')
3
2
  require 'timeout'
4
3
 
5
4
  # This file must be loaded after the JSON gem and any other library that beats up the Time class.
@@ -15,16 +14,6 @@ class Time
15
14
  %("#{u.strftime("%Y/%m/%d %H:%M:%S +0000")}")
16
15
  end
17
16
 
18
- # Decodes the JSON time format to a UTC time.
19
- # Based on Time.parse from ActiveSupport. ActiveSupport's version
20
- # is more complete, returning a time in your current timezone,
21
- # rather than keeping the time in UTC. YMMV.
22
- # def self.parse string, fallback=nil
23
- # d = DateTime.parse(string).new_offset
24
- # self.utc(d.year, d.month, d.day, d.hour, d.min, d.sec)
25
- # rescue
26
- # fallback
27
- # end
28
17
  end
29
18
 
30
19
  # Monkey patch for faster net/http io
@@ -51,63 +40,4 @@ if RUBY_VERSION.to_f < 1.9
51
40
  end
52
41
  end
53
42
 
54
- # module RestClient
55
- # # def self.copy(url, headers={})
56
- # # Request.execute(:method => :copy,
57
- # # :url => url,
58
- # # :headers => headers)
59
- # # end
60
- #
61
- # # class Request
62
- # #
63
- # # def establish_connection(uri)
64
- # # Thread.current[:connection].finish if (Thread.current[:connection] && Thread.current[:connection].started?)
65
- # # p net_http_class
66
- # # net = net_http_class.new(uri.host, uri.port)
67
- # # net.use_ssl = uri.is_a?(URI::HTTPS)
68
- # # net.verify_mode = OpenSSL::SSL::VERIFY_NONE
69
- # # Thread.current[:connection] = net
70
- # # Thread.current[:connection].start
71
- # # Thread.current[:connection]
72
- # # end
73
- # #
74
- # # def transmit(uri, req, payload)
75
- # # setup_credentials(req)
76
- # #
77
- # # Thread.current[:host] ||= uri.host
78
- # # Thread.current[:port] ||= uri.port
79
- # #
80
- # # if (Thread.current[:connection].nil? || (Thread.current[:host] != uri.host))
81
- # # p "establishing a connection"
82
- # # establish_connection(uri)
83
- # # end
84
- # #
85
- # # display_log request_log
86
- # # http = Thread.current[:connection]
87
- # # http.read_timeout = @timeout if @timeout
88
- # #
89
- # # begin
90
- # # res = http.request(req, payload)
91
- # # rescue
92
- # # p "Net::HTTP connection failed, reconnecting"
93
- # # establish_connection(uri)
94
- # # http = Thread.current[:connection]
95
- # # require 'ruby-debug'
96
- # # req.body_stream = nil
97
- # #
98
- # # res = http.request(req, payload)
99
- # # display_log response_log(res)
100
- # # result res
101
- # # else
102
- # # display_log response_log(res)
103
- # # process_result res
104
- # # end
105
- # #
106
- # # rescue EOFError
107
- # # raise RestClient::ServerBrokeConnection
108
- # # rescue Timeout::Error
109
- # # raise RestClient::RequestTimeout
110
- # # end
111
- # # end
112
- #
113
- # end
43
+
@@ -3,7 +3,7 @@ module RestAPI
3
3
  def put(uri, doc = nil)
4
4
  payload = doc.to_json if doc
5
5
  begin
6
- JSON.parse(HttpAbstraction.put(uri, payload))
6
+ JSON.parse(RestClient.put(uri, payload))
7
7
  rescue Exception => e
8
8
  if $DEBUG
9
9
  raise "Error while sending a PUT request #{uri}\npayload: #{payload.inspect}\n#{e}"
@@ -15,7 +15,7 @@ module RestAPI
15
15
 
16
16
  def get(uri)
17
17
  begin
18
- JSON.parse(HttpAbstraction.get(uri), :max_nesting => false)
18
+ JSON.parse(RestClient.get(uri), :max_nesting => false)
19
19
  rescue => e
20
20
  if $DEBUG
21
21
  raise "Error while sending a GET request #{uri}\n: #{e}"
@@ -28,7 +28,7 @@ module RestAPI
28
28
  def post(uri, doc = nil)
29
29
  payload = doc.to_json if doc
30
30
  begin
31
- JSON.parse(HttpAbstraction.post(uri, payload))
31
+ JSON.parse(RestClient.post(uri, payload))
32
32
  rescue Exception => e
33
33
  if $DEBUG
34
34
  raise "Error while sending a POST request #{uri}\npayload: #{payload.inspect}\n#{e}"
@@ -39,11 +39,14 @@ module RestAPI
39
39
  end
40
40
 
41
41
  def delete(uri)
42
- JSON.parse(HttpAbstraction.delete(uri))
42
+ JSON.parse(RestClient.delete(uri))
43
43
  end
44
44
 
45
45
  def copy(uri, destination)
46
- JSON.parse(HttpAbstraction.copy(uri, {'Destination' => destination}))
46
+ JSON.parse(RestClient::Request.execute( :method => :copy,
47
+ :url => uri,
48
+ :headers => {'Destination' => destination}
49
+ ).to_s)
47
50
  end
48
51
 
49
- end
52
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path("../../../spec_helper", __FILE__)
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
2
 
3
3
  describe CouchRest do
4
4
 
@@ -174,11 +174,24 @@ describe CouchRest do
174
174
  describe "using a proxy for RestClient connections" do
175
175
  it "should set proxy url for RestClient" do
176
176
  CouchRest.proxy 'http://localhost:8888/'
177
- proxy_uri = URI.parse(HttpAbstraction.proxy)
177
+ proxy_uri = URI.parse(RestClient.proxy)
178
178
  proxy_uri.host.should eql( 'localhost' )
179
179
  proxy_uri.port.should eql( 8888 )
180
180
  CouchRest.proxy nil
181
181
  end
182
182
  end
183
183
 
184
- end
184
+
185
+ describe "Including old ExtendedDocument library" do
186
+
187
+ it "should raise an exception" do
188
+ lambda do
189
+ class TestDoc < CouchRest::ExtendedDocument
190
+ attr_reader :fail
191
+ end
192
+ end.should raise_error(RuntimeError)
193
+ end
194
+
195
+ end
196
+
197
+ end