couch_potato 0.2.27 → 0.2.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGES.md +6 -0
  2. data/README.md +16 -2
  3. data/VERSION.yml +2 -2
  4. data/lib/core_ext/string.rb +11 -11
  5. data/lib/couch_potato.rb +10 -8
  6. data/lib/couch_potato/rspec.rb +2 -0
  7. data/lib/couch_potato/rspec/matchers.rb +2 -2
  8. data/lib/couch_potato/rspec/stub_db.rb +46 -0
  9. data/lib/couch_potato/validation.rb +2 -2
  10. data/lib/couch_potato/view/base_view_spec.rb +1 -1
  11. data/lib/couch_potato/view/custom_views.rb +5 -5
  12. data/lib/couch_potato/view/view_query.rb +1 -1
  13. data/rails/reload_classes.rb +31 -5
  14. data/spec/attachments_spec.rb +1 -1
  15. data/spec/callbacks_spec.rb +1 -1
  16. data/spec/create_spec.rb +1 -1
  17. data/spec/custom_view_spec.rb +1 -1
  18. data/spec/default_property_spec.rb +1 -1
  19. data/spec/destroy_spec.rb +1 -1
  20. data/spec/property_spec.rb +1 -1
  21. data/spec/rails_spec.rb +38 -7
  22. data/spec/unit/active_model_compliance_spec.rb +1 -1
  23. data/spec/unit/attributes_spec.rb +1 -1
  24. data/spec/unit/base_view_spec_spec.rb +9 -4
  25. data/spec/unit/callbacks_spec.rb +1 -1
  26. data/spec/unit/couch_potato_spec.rb +1 -1
  27. data/spec/unit/create_spec.rb +1 -1
  28. data/spec/unit/customs_views_spec.rb +1 -1
  29. data/spec/unit/database_spec.rb +1 -1
  30. data/spec/unit/date_spec.rb +1 -1
  31. data/spec/unit/dirty_attributes_spec.rb +1 -1
  32. data/spec/unit/json_create_id_spec.rb +1 -1
  33. data/spec/unit/model_view_spec_spec.rb +1 -1
  34. data/spec/unit/rspec_matchers_spec.rb +2 -2
  35. data/spec/unit/rspec_stub_db_spec.rb +35 -0
  36. data/spec/unit/string_spec.rb +8 -4
  37. data/spec/unit/time_spec.rb +1 -1
  38. data/spec/unit/validation_spec.rb +1 -1
  39. data/spec/unit/view_query_spec.rb +1 -1
  40. data/spec/update_spec.rb +1 -1
  41. data/spec/view_updates_spec.rb +1 -1
  42. metadata +35 -17
data/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Changes
2
2
 
3
+ ### 0.2.28
4
+ * fixed reloading nested classes (langalex)
5
+ * fixed constant missing error when loading models with uninitialized classes via views (langalex)
6
+ * added rspec helpers for stubbing out views (langalex)
7
+ * fixed design document names for nested model classes (svenfuchs)
8
+
3
9
  ### 0.2.27
4
10
  * workaround for Rails apps using bundler: database name was not initialized from couchdb.yml (langalex)
5
11
 
data/README.md CHANGED
@@ -304,6 +304,20 @@ To make testing easier and faster database logic has been put into its own class
304
304
 
305
305
  By creating you own instances of CouchPotato::Database and passing them a fake CouchRest database instance you can completely disconnect your unit tests/spec from the database.
306
306
 
307
+ For stubbing out the database couch potato offers some helpers:
308
+
309
+ class Comment
310
+ view :by_commenter_id, :key => :commenter_id
311
+ end
312
+
313
+ # RSpec
314
+ require 'couch_potato/rspec'
315
+
316
+ db = stub_db # stubs CouchPotato.database
317
+ db.stub_view(Comment, :by_commenter_id).with('23').and_return([:comment1, :comment2])
318
+
319
+ CouchPotato.database.view(Comment.by_commenter_id('23)) # => [:comment1, :comment2]
320
+
307
321
  ##### Testing map/reduce functions
308
322
 
309
323
  Couch Potato provides custom RSpec matchers for testing the map and reduce functions of your views. For example you can do this:
@@ -316,11 +330,11 @@ Couch Potato provides custom RSpec matchers for testing the map and reduce funct
316
330
  end
317
331
 
318
332
  #RSpec
319
- require 'couch_potato/rspec/matchers'
333
+ require 'couch_potato/rspec'
320
334
 
321
335
  describe User, 'by_name' do
322
336
  it "should map users to their name" do
323
- User.by_name.should map({:name => 'bill', :age => 23}).to(['bill', null])
337
+ User.by_name.should map(User.new(:name => 'bill', :age => 23)).to(['bill', null])
324
338
  end
325
339
 
326
340
  it "should reduce the users to the sum of their age" do
@@ -1,5 +1,5 @@
1
1
  ---
2
- :major: 0
3
2
  :minor: 2
4
- :patch: 27
3
+ :patch: 28
5
4
  :build:
5
+ :major: 0
@@ -4,16 +4,16 @@ module ActiveSupportMethods
4
4
  $1.upcase
5
5
  end
6
6
  end
7
-
8
- # Source
9
- # http://github.com/rails/rails/blob/b600bf2cd728c90d50cc34456c944b2dfefe8c8d/activesupport/lib/active_support/inflector.rb
10
- def underscore
11
- gsub(/::/, '/').
12
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
13
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
14
- tr("-", "_").
15
- downcase
16
- end
17
7
  end
8
+ String.send :include, ActiveSupportMethods unless String.new.respond_to?(:underscore)
18
9
 
19
- String.send :include, ActiveSupportMethods unless String.new.respond_to?(:underscore)
10
+ class String
11
+ # inspired by http://github.com/rails/rails/blob/b600bf2cd728c90d50cc34456c944b2dfefe8c8d/activesupport/lib/active_support/inflector.rb
12
+ def snake_case(seperator = '/')
13
+ string = seperator == '::' ? dup : gsub(/::/, '/')
14
+ string.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
15
+ string.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
16
+ string.tr!("-", "_")
17
+ string.downcase
18
+ end
19
+ end
@@ -35,11 +35,13 @@ unless defined?(CouchPotato)
35
35
  end
36
36
  end
37
37
 
38
- require File.dirname(__FILE__) + '/core_ext/object'
39
- require File.dirname(__FILE__) + '/core_ext/time'
40
- require File.dirname(__FILE__) + '/core_ext/date'
41
- require File.dirname(__FILE__) + '/core_ext/string'
42
- require File.dirname(__FILE__) + '/core_ext/symbol'
43
- require File.dirname(__FILE__) + '/couch_potato/validation'
44
- require File.dirname(__FILE__) + '/couch_potato/persistence'
45
- require File.dirname(__FILE__) + '/couch_potato/railtie' if defined?(Rails)
38
+ $LOAD_PATH << File.dirname(__FILE__)
39
+
40
+ require 'core_ext/object'
41
+ require 'core_ext/time'
42
+ require 'core_ext/date'
43
+ require 'core_ext/string'
44
+ require 'core_ext/symbol'
45
+ require 'couch_potato/validation'
46
+ require 'couch_potato/persistence'
47
+ require 'couch_potato/railtie' if defined?(Rails)
@@ -0,0 +1,2 @@
1
+ require 'couch_potato/rspec/stub_db'
2
+ require 'couch_potato/rspec/matchers'
@@ -13,8 +13,8 @@ module CouchPotato
13
13
  end
14
14
 
15
15
 
16
- require File.dirname(__FILE__) + '/matchers/map_to_matcher'
17
- require File.dirname(__FILE__) + '/matchers/reduce_to_matcher'
16
+ require 'couch_potato/rspec/matchers/map_to_matcher'
17
+ require 'couch_potato/rspec/matchers/reduce_to_matcher'
18
18
 
19
19
  module Spec
20
20
  module Matchers
@@ -0,0 +1,46 @@
1
+ module CouchPotato::RSpec
2
+
3
+ module StubView
4
+ class ViewStub
5
+ def initialize(clazz, view, db)
6
+ @clazz = clazz
7
+ @view = view
8
+ @db = db
9
+ end
10
+
11
+ def with(*args)
12
+ @args = args
13
+ self
14
+ end
15
+
16
+ def and_return(return_value)
17
+ view_stub = Spec::Mocks::Mock.new("#{@clazz}.#{@view}(#{@args.try(:join, ', ')}) view")
18
+ _stub = @clazz.stub(@view)
19
+ _stub.with(*@args) if @args
20
+ _stub.and_return(view_stub)
21
+ @db.stub(:view).with(view_stub).and_return(return_value)
22
+ end
23
+ end
24
+
25
+ def stub_view(clazz, view)
26
+ ViewStub.new clazz, view, self
27
+ end
28
+ end
29
+
30
+ module StubDb
31
+ def stub_db(options = {})
32
+ db = stub('db', options)
33
+ db.extend CouchPotato::RSpec::StubView
34
+ CouchPotato.stub(:database => db)
35
+ db
36
+ end
37
+ end
38
+ end
39
+
40
+ module Spec
41
+ module Mocks
42
+ module ExampleMethods
43
+ include CouchPotato::RSpec::StubDb
44
+ end
45
+ end
46
+ end
@@ -3,10 +3,10 @@ module CouchPotato
3
3
  def self.included(base) #:nodoc:
4
4
  case CouchPotato::Config.validation_framework
5
5
  when :validatable
6
- require File.dirname(__FILE__) + '/validation/with_validatable'
6
+ require 'couch_potato/validation/with_validatable'
7
7
  base.send :include, CouchPotato::Validation::WithValidatable
8
8
  when :active_model
9
- require File.dirname(__FILE__) + '/validation/with_active_model'
9
+ require 'couch_potato/validation/with_active_model'
10
10
  base.send :include, CouchPotato::Validation::WithActiveModel
11
11
  else
12
12
  raise "Unknown CouchPotato::Config.validation_framework #{CouchPotato::Config.validation_framework.inspect}, options are :validatable or :active_model"
@@ -8,7 +8,7 @@ module CouchPotato
8
8
  normalized_view_parameters = normalize_view_parameters view_parameters
9
9
  assert_valid_view_parameters normalized_view_parameters
10
10
  @klass = klass
11
- @design_document = klass.to_s.underscore
11
+ @design_document = klass.to_s.snake_case('::')
12
12
  @view_name = view_name
13
13
  @options = options
14
14
  @view_parameters = {}
@@ -1,8 +1,8 @@
1
- require File.dirname(__FILE__) + '/base_view_spec'
2
- require File.dirname(__FILE__) + '/model_view_spec'
3
- require File.dirname(__FILE__) + '/properties_view_spec'
4
- require File.dirname(__FILE__) + '/custom_view_spec'
5
- require File.dirname(__FILE__) + '/raw_view_spec'
1
+ require 'couch_potato/view/base_view_spec'
2
+ require 'couch_potato/view/model_view_spec'
3
+ require 'couch_potato/view/properties_view_spec'
4
+ require 'couch_potato/view/custom_view_spec'
5
+ require 'couch_potato/view/raw_view_spec'
6
6
 
7
7
 
8
8
  module CouchPotato
@@ -14,7 +14,7 @@ module CouchPotato
14
14
  update_view unless view_has_been_updated?
15
15
  begin
16
16
  query_view parameters
17
- rescue RestClient::ResourceNotFound# => e
17
+ rescue RestClient::ResourceNotFound
18
18
  update_view
19
19
  retry
20
20
  end
@@ -1,18 +1,44 @@
1
1
  module CouchPotato
2
- Database.class_eval do
3
- def load_document_with_class_reloading(id)
2
+
3
+ module ClassReloading
4
+ private
5
+
6
+ def with_class_reloading(&block)
4
7
  begin
5
- load_document_without_class_reloading id
8
+ yield
6
9
  rescue ArgumentError => e
7
10
  if(name = e.message.scan(/(can't find const|undefined class\/module) ([\w\:]+)/).first[1])
8
- eval name
11
+ eval name.gsub(/\:+$/, '')
9
12
  retry
10
13
  else
11
14
  raise e
12
15
  end
13
16
  end
14
17
  end
15
-
18
+ end
19
+
20
+ View::ViewQuery.class_eval do
21
+ include ClassReloading
22
+
23
+ def query_view_with_class_reloading(*args)
24
+ with_class_reloading do
25
+ query_view_without_class_reloading(*args)
26
+ end
27
+ end
28
+
29
+ alias_method :query_view_without_class_reloading, :query_view
30
+ alias_method :query_view, :query_view_with_class_reloading
31
+ end
32
+
33
+ Database.class_eval do
34
+ include ClassReloading
35
+
36
+ def load_document_with_class_reloading(*args)
37
+ with_class_reloading do
38
+ load_document_without_class_reloading *args
39
+ end
40
+ end
41
+
16
42
  alias_method :load_document_without_class_reloading, :load_document
17
43
  alias_method :load_document, :load_document_with_class_reloading
18
44
  alias_method :load, :load_document
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe CouchPotato, 'attachments' do
4
4
  it "should persist an attachment" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  class CallbackRecorder
4
4
  include CouchPotato::Persistence
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe "create" do
4
4
  before(:all) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  class Build
4
4
  include CouchPotato::Persistence
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  class Test
4
4
  include CouchPotato::Persistence
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe 'destroy' do
4
4
  before(:all) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
  require File.join(File.dirname(__FILE__), 'fixtures', 'address')
3
3
  require File.join(File.dirname(__FILE__), 'fixtures', 'person')
4
4
 
@@ -1,20 +1,51 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
  require File.dirname(__FILE__) + '/../rails/reload_classes'
3
3
 
4
- class Autoloader
5
- def self.const_missing(name)
6
- eval("#{name} = Class.new; #{name}.send(:include, CouchPotato::Persistence)")
4
+ module LoadConst
5
+ def const_missing(name)
6
+ name = "#{self.name}::#{name}"
7
+ eval("#{name} = Class.new; #{name}.send(:include, CouchPotato::Persistence); #{name}.extend(LoadConst)")
7
8
  end
8
9
  end
9
10
 
11
+ class Autoloader
12
+ extend LoadConst
13
+ end
14
+
15
+ class WithUnloadedEmbedded
16
+ include CouchPotato::Persistence
17
+ extend LoadConst
18
+
19
+ property :embedded
20
+
21
+ view :all, :type => :custom, :map => 'function(doc) {emit(doc._id, null)}', :include_docs => true
22
+ end
23
+
10
24
 
11
25
  describe CouchPotato::Database, 'rails specific behavior' do
12
26
 
13
- it "should load models whose constants are currently uninitialized (like with rails in development mode)" do
27
+ before(:each) do
14
28
  recreate_db
15
- CouchPotato.couchrest_database.save_doc(JSON.create_id => 'Autoloader::Uninitialized', '_id' => '1')
16
- CouchPotato.database.load('1').class.name.should == 'Autoloader::Uninitialized'
17
29
  end
18
30
 
31
+ context 'load a document' do
32
+ it "should load models whose constants are currently uninitialized (like with rails in development mode)" do
33
+ CouchPotato.couchrest_database.save_doc(JSON.create_id => 'Autoloader::Uninitialized', '_id' => '1')
34
+ CouchPotato.database.load('1').class.name.should == 'Autoloader::Uninitialized'
35
+ end
36
+
37
+ it "should load nested models" do
38
+ CouchPotato.couchrest_database.save_doc(JSON.create_id => 'Autoloader::Nested::Nested2', '_id' => '1')
39
+ CouchPotato.database.load('1').class.name.should == 'Autoloader::Nested::Nested2'
40
+ end
41
+ end
42
+
43
+ context 'load documents using a view' do
44
+ it "should load models from a view whose constants are currently uninitialized" do
45
+ doc = {JSON.create_id => 'WithUnloadedEmbedded', '_id' => '1', 'embedded' => {JSON.create_id => 'WithUnloadedEmbedded::Uninitialized'}}
46
+ CouchPotato.couchrest_database.save_doc(doc)
47
+ CouchPotato.database.view(WithUnloadedEmbedded.all).first.embedded.class.name.should == 'WithUnloadedEmbedded::Uninitialized'
48
+ end
49
+ end
19
50
  end
20
51
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  begin
4
4
  require 'active_model'
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  class Plant
4
4
  include CouchPotato::Persistence
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe CouchPotato::View::BaseViewSpec, 'initialize' do
4
4
  describe "view parameters" do
@@ -33,14 +33,19 @@ describe CouchPotato::View::BaseViewSpec, 'initialize' do
33
33
  spec = CouchPotato::View::BaseViewSpec.new Object, 'all', {}, {:key => '1'..'2'}
34
34
  spec.view_parameters.should == {:startkey => '1', :endkey => '2'}
35
35
  end
36
-
36
+
37
37
  it "should convert a plain value to a hash with a key" do
38
38
  spec = CouchPotato::View::BaseViewSpec.new Object, 'all', {}, '2'
39
39
  spec.view_parameters.should == {:key => '2'}
40
40
  end
41
-
41
+
42
+ it "generates the design document path by snake_casing the class name but keeping double colons" do
43
+ spec = CouchPotato::View::BaseViewSpec.new 'Foo::BarBaz', '', {}, ''
44
+ spec.design_document.should == 'foo::bar_baz'
45
+ end
46
+
42
47
  end
43
-
48
+
44
49
  end
45
50
 
46
51
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe 'before_validation callback' do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe CouchPotato, 'full_url_to_database' do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe "create" do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe CouchPotato::View::CustomViews do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  class DbTestUser
4
4
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe Date, 'to_json' do
4
4
  it "should format the date in a way that i can use it for sorting in couchdb" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  class Plate
4
4
  include CouchPotato::Persistence
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  class Drink
4
4
  include CouchPotato::Persistence
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe CouchPotato::View::ModelViewSpec, 'map_function' do
4
4
  it "should include conditions" do
@@ -1,5 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require 'couch_potato/rspec/matchers'
1
+ require 'spec_helper'
2
+ require 'couch_potato/rspec'
3
3
  require 'ostruct'
4
4
 
5
5
  describe CouchPotato::RSpec::MapToMatcher do
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+ require 'couch_potato/rspec'
3
+
4
+ class WithStubbedView
5
+ include CouchPotato::Persistence
6
+
7
+ view :stubbed_view, :key => :x
8
+ end
9
+
10
+ describe "stubbing the db" do
11
+ it "should replace CouchPotato.database with a stub" do
12
+ stub_db
13
+ CouchPotato.database.should be_a(Spec::Mocks::Mock)
14
+ end
15
+
16
+ it "should return the stub" do
17
+ db = stub_db
18
+ CouchPotato.database.should == db
19
+ end
20
+ end
21
+
22
+ describe "stubbing a view" do
23
+ before(:each) do
24
+ @db = stub_db
25
+ @db.stub_view(WithStubbedView, :stubbed_view).with('123').and_return([:result])
26
+ end
27
+
28
+ it "should stub the view to return a stub" do
29
+ WithStubbedView.stubbed_view('123').should be_a(Spec::Mocks::Mock)
30
+ end
31
+
32
+ it "should stub the database to return fake results when called with the stub" do
33
+ @db.view(WithStubbedView.stubbed_view('123')).should == [:result]
34
+ end
35
+ end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe String, 'camelize' do
4
4
  it "should camelize a string" do
@@ -6,8 +6,12 @@ describe String, 'camelize' do
6
6
  end
7
7
  end
8
8
 
9
- describe String, 'underscore' do
10
- it "should underscore a string" do
11
- 'MyString'.underscore.should == 'my_string'
9
+ describe String, 'snake_case' do
10
+ it "should snake_case a string" do
11
+ 'MyString'.snake_case.should == 'my_string'
12
+ end
13
+
14
+ it "should snake_case a string using a custom separator" do
15
+ 'My::String'.snake_case('::').should == 'my::string'
12
16
  end
13
17
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe Time, 'to_json' do
4
4
  it "should convert to utc and format the time in a way that i can use it for sorting in couchdb" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe 'CouchPotato::Config.validation_framework' do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe CouchPotato::View::ViewQuery, 'query_view' do
4
4
  it "should not pass a key if conditions are empty" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe "create" do
4
4
  before(:all) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe "automatic view updates" do
4
4
  before(:each) do
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_potato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.27
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 28
9
+ version: 0.2.28
5
10
  platform: ruby
6
11
  authors:
7
12
  - Alexander Lang
@@ -9,39 +14,46 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-03-05 00:00:00 +01:00
17
+ date: 2010-03-31 00:00:00 +02:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: json
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  - !ruby/object:Gem::Dependency
26
33
  name: validatable
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
33
41
  version: "0"
34
- version:
42
+ type: :runtime
43
+ version_requirements: *id002
35
44
  - !ruby/object:Gem::Dependency
36
45
  name: couchrest
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
40
48
  requirements:
41
49
  - - ">="
42
50
  - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ - 24
43
54
  version: "0.24"
44
- version:
55
+ type: :runtime
56
+ version_requirements: *id003
45
57
  description: Ruby persistence layer for CouchDB
46
58
  email: alex@upstream-berlin.com
47
59
  executables: []
@@ -75,10 +87,12 @@ files:
75
87
  - lib/couch_potato/persistence/simple_property.rb
76
88
  - lib/couch_potato/persistence/type_caster.rb
77
89
  - lib/couch_potato/railtie.rb
90
+ - lib/couch_potato/rspec.rb
78
91
  - lib/couch_potato/rspec/matchers.rb
79
92
  - lib/couch_potato/rspec/matchers/map_to_matcher.rb
80
93
  - lib/couch_potato/rspec/matchers/print_r.js
81
94
  - lib/couch_potato/rspec/matchers/reduce_to_matcher.rb
95
+ - lib/couch_potato/rspec/stub_db.rb
82
96
  - lib/couch_potato/validation.rb
83
97
  - lib/couch_potato/validation/with_active_model.rb
84
98
  - lib/couch_potato/validation/with_validatable.rb
@@ -116,6 +130,7 @@ files:
116
130
  - spec/unit/json_create_id_spec.rb
117
131
  - spec/unit/model_view_spec_spec.rb
118
132
  - spec/unit/rspec_matchers_spec.rb
133
+ - spec/unit/rspec_stub_db_spec.rb
119
134
  - spec/unit/string_spec.rb
120
135
  - spec/unit/time_spec.rb
121
136
  - spec/unit/validation_spec.rb
@@ -135,18 +150,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
150
  requirements:
136
151
  - - ">="
137
152
  - !ruby/object:Gem::Version
153
+ segments:
154
+ - 0
138
155
  version: "0"
139
- version:
140
156
  required_rubygems_version: !ruby/object:Gem::Requirement
141
157
  requirements:
142
158
  - - ">="
143
159
  - !ruby/object:Gem::Version
160
+ segments:
161
+ - 0
144
162
  version: "0"
145
- version:
146
163
  requirements: []
147
164
 
148
165
  rubyforge_project:
149
- rubygems_version: 1.3.5
166
+ rubygems_version: 1.3.6
150
167
  signing_key:
151
168
  specification_version: 3
152
169
  summary: Ruby persistence layer for CouchDB
@@ -175,6 +192,7 @@ test_files:
175
192
  - spec/unit/json_create_id_spec.rb
176
193
  - spec/unit/model_view_spec_spec.rb
177
194
  - spec/unit/rspec_matchers_spec.rb
195
+ - spec/unit/rspec_stub_db_spec.rb
178
196
  - spec/unit/string_spec.rb
179
197
  - spec/unit/time_spec.rb
180
198
  - spec/unit/validation_spec.rb