gotime-cassandra_object 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'gotime-cassandra_object'
5
- s.version = '3.0.4'
5
+ s.version = '3.0.5'
6
6
  s.description = 'Cassandra ActiveModel'
7
7
  s.summary = 'Cassandra ActiveModel'
8
8
  s.authors = ["Michael Koziarski", "gotime"]
@@ -61,6 +61,17 @@ module CassandraObject
61
61
  end
62
62
  end
63
63
 
64
+ def initialize_dup(other)
65
+ @attributes = other.attributes
66
+ @attributes['created_at'] = nil
67
+ @attributes['updated_at'] = nil
68
+ @attributes.delete(self.class.primary_key)
69
+ @id = nil
70
+ @new_record = true
71
+ @destroyed = false
72
+ super
73
+ end
74
+
64
75
  def to_param
65
76
  id
66
77
  end
@@ -24,6 +24,18 @@ class CassandraObject::BaseTest < CassandraObject::TestCase
24
24
  assert !issue.destroyed?
25
25
  end
26
26
 
27
+ test 'dup' do
28
+ issue = Issue.create description: 'foo'
29
+
30
+ dup_issue = issue.dup
31
+
32
+ assert dup_issue.new_record?
33
+ assert_not_equal issue.id, dup_issue.id
34
+ assert_nil dup_issue.created_at
35
+ assert_nil dup_issue.updated_at
36
+ assert_equal 'foo', issue.description
37
+ end
38
+
27
39
  test 'equality of new records' do
28
40
  assert_not_equal Issue.new, Issue.new
29
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotime-cassandra_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-23 00:00:00.000000000 Z
13
+ date: 2012-07-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel