store-active_record 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42f3fe90f465400a5ee47bf966064d5524e8513e
4
- data.tar.gz: 5500796f19ed583a942c21ade03224a581427e83
3
+ metadata.gz: 5115077af122d269dba67a6c751fa3c7bf23ec2b
4
+ data.tar.gz: 705e57d4764e3ee9b48e75f601759e4780844976
5
5
  SHA512:
6
- metadata.gz: 47dd7344d47dba4d79e6d5e9ff832a784fead9e720d885cd65e69f916b332053984633b14f215a4cf6871b80d0b42d6fe6ed09208632aeb22911ef9b2342c2f5
7
- data.tar.gz: 816f34ac738052bd6b71fc72b16b901b502281ad14874228957373b0e914c5b95d39069d4dd7119cd4895c5f5c901d0626133ed9a282f726fcaa372fe79d6dd3
6
+ metadata.gz: ccac37d80174ad96ba4ad66af661c7ccfed3a50d5bda72ec56e128178096641fcad5d24268f09ce544b1e40f6d41ff95e23f1217155ca62a05211944bd8caedf
7
+ data.tar.gz: 1cb2023e4b3afe7176d39c868e1073be925afb99adcfef9f93f859fddcb87cf5370ec88effaad8e59c71bb5fc74ca67a36dc1b750f55638ec6fa834fc038cf00
@@ -77,6 +77,8 @@ class Store
77
77
  def to_hash
78
78
  attributes.dup.tap do |a|
79
79
  a['uid'] = a.delete('id').to_s # ActiveRecord detail
80
+ a.delete('created_at')
81
+ a.delete('updated_at')
80
82
  end
81
83
  end
82
84
  end
@@ -1,5 +1,5 @@
1
1
  class Store
2
2
  class ActiveRecord
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
@@ -43,4 +43,21 @@ describe Store::DataMapper::ActiveRecord do
43
43
  end
44
44
  end
45
45
 
46
+ describe 'single find remove active record specific attributes' do
47
+ establish_connection
48
+ recreate_table
49
+
50
+ before { empty_table }
51
+
52
+ subject { Store::DataMapper::ActiveRecord.new(table) }
53
+
54
+ it 'removes the id, updated_at and created_at and build uid as virtual attribute from id' do
55
+ id = subject.insert({:foo => 'my foo'})
56
+
57
+ expected = {"foo"=>"my foo", "uid"=>id.to_s}
58
+
59
+ assert_equal expected, subject.single_find(id)
60
+ end
61
+ end
62
+
46
63
  end
data/spec/helper.rb CHANGED
@@ -13,6 +13,8 @@ require 'store/active_record'
13
13
  ensure
14
14
  ::ActiveRecord::Migration.create_table(table) do |t|
15
15
  t.string :foo
16
+ t.datetime :created_at
17
+ t.datetime :updated_at
16
18
  end
17
19
  end
18
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: store-active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Owiesniak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-01 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler