simply_stored 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  =============
3
3
 
4
+ 0.5.1
5
+
6
+ - Fix nullifying soft deleted objects when they are not deleted
7
+
4
8
  0.5.0
5
9
 
6
10
  - Add support for has_and_belongs_to_many relations:
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ GEM
2
+ specs:
3
+ activesupport (2.3.11)
4
+ couch_potato (0.2.31.2)
5
+ couchrest (>= 0.24)
6
+ json
7
+ couchrest (1.0.1)
8
+ json (>= 1.4.6)
9
+ mime-types (>= 1.15)
10
+ rest-client (>= 1.5.1)
11
+ json (1.4.6)
12
+ mattmatt-validatable (1.8.4)
13
+ mime-types (1.16)
14
+ mocha (0.9.8)
15
+ rake
16
+ rake (0.8.7)
17
+ rest-client (1.6.1)
18
+ mime-types (>= 1.16)
19
+ right_aws (2.0.0)
20
+ right_http_connection (>= 1.2.1)
21
+ right_http_connection (1.2.4)
22
+ shoulda (2.10.3)
23
+ shoulda-addons (0.2.2)
24
+ uuidtools (2.1.1)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ activesupport (= 2.3.11)
31
+ couch_potato (= 0.2.31.2)
32
+ couchrest (= 1.0.1)
33
+ mattmatt-validatable (= 1.8.4)
34
+ mocha
35
+ rest-client (= 1.6.1)
36
+ right_aws
37
+ shoulda
38
+ shoulda-addons
39
+ uuidtools
@@ -42,7 +42,7 @@ module SimplyStored
42
42
  end
43
43
 
44
44
  def last(*args)
45
- find(:first, :order => :desc, *args)
45
+ find(:first, {:order => :desc}, *args)
46
46
  end
47
47
 
48
48
  def count(options = {})
@@ -159,7 +159,7 @@ module SimplyStored
159
159
  # skip
160
160
  else
161
161
  # nullify
162
- unless dependent.class.soft_deleting_enabled?
162
+ unless dependent.class.soft_deleting_enabled? && dependent.deleted?
163
163
  dependent.send("#{self.class.foreign_property}=", nil)
164
164
  dependent.save(false)
165
165
  end
data/lib/simply_stored.rb CHANGED
@@ -4,7 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/simply_stored/storage')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/simply_stored/class_methods_base')
5
5
 
6
6
  module SimplyStored
7
- VERSION = '0.5.0'
7
+ VERSION = '0.5.1'
8
8
  class Error < RuntimeError; end
9
9
  class RecordNotFound < RuntimeError; end
10
10
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  begin
4
4
  require 'active_model'
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class BelongsToTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class ConflictHandlingTest < Test::Unit::TestCase
data/test/finder_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class FinderTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class HasAndBelongsToManyTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class HasManyTest < Test::Unit::TestCase
data/test/has_one_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class HasOneTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class InstanceLifecycleTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class MassAssignmentProtectionTest < Test::Unit::TestCase
data/test/s3_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class S3Test < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class SoftDeletableTest < Test::Unit::TestCase
@@ -171,10 +171,19 @@ class SoftDeletableTest < Test::Unit::TestCase
171
171
  assert_nil @rash.hemorrhoid_id
172
172
  end
173
173
 
174
- should "not nullify dependents if they are soft-deletable" do
174
+ should "nullify dependents if they are soft-deletable and deleted" do
175
175
  small_rash = SmallRash.create(:hemorrhoid => @hemorrhoid)
176
176
  @hemorrhoid.reload
177
177
  @hemorrhoid.destroy
178
+ assert @hemorrhoid.deleted?
179
+ small_rash = SmallRash.find(small_rash.id)
180
+ assert_nil small_rash.hemorrhoid_id
181
+ end
182
+
183
+ should "not nullify dependents if they are soft-deletable and not deleted" do
184
+ small_rash = SmallRash.create(:hemorrhoid => @hemorrhoid)
185
+ @hemorrhoid.reload
186
+ assert !@hemorrhoid.deleted?
178
187
  small_rash = SmallRash.find(small_rash.id)
179
188
  assert_not_nil small_rash.hemorrhoid_id
180
189
  assert_equal @hemorrhoid.id, small_rash.hemorrhoid_id
data/test/test_helper.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'test/unit'
3
+ require 'bundler/setup'
4
+ require 'active_support/testing/assertions'
3
5
  require 'shoulda'
4
6
  require 'mocha'
5
- require 'active_support'
6
- require 'active_support/testing/assertions'
7
7
  $:.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
8
8
  puts File.expand_path(File.dirname(__FILE__) + "/lib")
9
9
  require 'simply_stored'
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class ValidationsTest < Test::Unit::TestCase
data/test/views_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
  require File.expand_path(File.dirname(__FILE__) + '/fixtures/couch')
3
3
 
4
4
  class CustomViewUser
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simply_stored
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mathias Meyer, Jonathan Weiss
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-22 00:00:00 +01:00
18
+ date: 2011-03-25 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -89,6 +89,7 @@ extra_rdoc_files:
89
89
  - README.md
90
90
  files:
91
91
  - CHANGELOG.md
92
+ - Gemfile.lock
92
93
  - LICENSE.txt
93
94
  - README.md
94
95
  - lib/simply_stored.rb