diametric 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ def gen_entity_class(named = 'generated_entity_class', &block)
2
+ Class.new do
3
+ include Diametric::Entity
4
+ namespace_prefix named
5
+ instance_eval &block
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  shared_examples "persistence API" do
2
- describe "an instance" do
2
+ describe "entity instance" do
3
3
  let(:model) { model_class.new }
4
4
 
5
5
  it "can save" do
@@ -22,6 +22,26 @@ shared_examples "persistence API" do
22
22
  model.save.should be_false
23
23
  end
24
24
 
25
+ describe '#update_attributes' do
26
+ it "saves and updates values" do
27
+ model = model_class.new(:name => "Stu").tap(&:save)
28
+ new_values = { "name" => "Stuart" }
29
+ model.update_attributes(new_values)
30
+
31
+ model.should_not be_changed
32
+ model.name.should == "Stuart"
33
+ end
34
+ end
35
+
36
+ describe "#assign_attributes" do
37
+ it "updates attribute values" do
38
+ model.assign_attributes(:name => "Stuart")
39
+ model.name.should == "Stuart"
40
+ end
41
+
42
+ pending "it should do _something_ when attribute doesn't exist"
43
+ end
44
+
25
45
  context "that is saved in Datomic" do
26
46
  before(:each) do
27
47
  model.name = "Wilbur"
@@ -63,6 +83,18 @@ shared_examples "persistence API" do
63
83
  mice = model_class.filter(:>, :age, 3).all
64
84
  mice.should == []
65
85
  end
86
+
87
+ it "can find all" do
88
+ model_class.new(:name => "Smith", :age => 5).save
89
+ mice = model_class.all
90
+ mice.size.should == 2
91
+ names = ["Smith", "Wilbur"]
92
+ mice.each do |m|
93
+ names.include?(m.name).should be_true
94
+ names.delete(m.name).should == m.name
95
+ end
96
+ names.size.should == 0
97
+ end
66
98
  end
67
99
  end
68
100
  end
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diametric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Clinton N. Dreisbach
9
+ - Ryan K. Neufeld
10
+ - Yoko Harada
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2012-11-01 00:00:00.000000000 Z
14
+ date: 2012-11-29 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: edn
@@ -76,21 +78,21 @@ dependencies:
76
78
  - !ruby/object:Gem::Version
77
79
  version: 0.4.1
78
80
  - !ruby/object:Gem::Dependency
79
- name: lock_jar
81
+ name: rspec
80
82
  requirement: !ruby/object:Gem::Requirement
81
83
  none: false
82
84
  requirements:
83
- - - ~>
85
+ - - ! '>='
84
86
  - !ruby/object:Gem::Version
85
- version: 0.7.2
87
+ version: '0'
86
88
  type: :runtime
87
89
  prerelease: false
88
90
  version_requirements: !ruby/object:Gem::Requirement
89
91
  none: false
90
92
  requirements:
91
- - - ~>
93
+ - - ! '>='
92
94
  - !ruby/object:Gem::Version
93
- version: 0.7.2
95
+ version: '0'
94
96
  description: ! 'Diametric is a library for building schemas, queries, and transactions
95
97
 
96
98
  for Datomic from Ruby objects. It is also used to map Ruby objects
@@ -100,37 +102,47 @@ description: ! 'Diametric is a library for building schemas, queries, and transa
100
102
  '
101
103
  email:
102
104
  - crnixon@gmail.com
105
+ - ryan@thinkrelevance.com
106
+ - yoko@thinkrelevance.com
103
107
  executables: []
104
108
  extensions:
105
109
  - Rakefile
106
110
  extra_rdoc_files: []
107
111
  files:
108
- - .gitignore
109
112
  - Gemfile
110
- - Guardfile
111
113
  - Jarfile
112
114
  - Jarfile.lock
113
115
  - LICENSE.txt
114
116
  - README.md
115
117
  - Rakefile
116
- - TODO.org
117
118
  - diametric.gemspec
118
- - lib/diametric.rb
119
+ - lib/diametric/config/environment.rb
120
+ - lib/diametric/config.rb
119
121
  - lib/diametric/entity.rb
122
+ - lib/diametric/generators/active_model.rb
120
123
  - lib/diametric/persistence/common.rb
121
124
  - lib/diametric/persistence/peer.rb
122
125
  - lib/diametric/persistence/rest.rb
126
+ - lib/diametric/persistence.rb
123
127
  - lib/diametric/query.rb
128
+ - lib/diametric/railtie.rb
124
129
  - lib/diametric/version.rb
130
+ - lib/diametric.rb
125
131
  - lib/jrclj.rb
132
+ - lib/tasks/create_schema.rb
133
+ - lib/tasks/diametric_config.rb
134
+ - spec/diametric/config_spec.rb
126
135
  - spec/diametric/entity_spec.rb
127
136
  - spec/diametric/persistence/peer_spec.rb
128
137
  - spec/diametric/persistence/rest_spec.rb
138
+ - spec/diametric/persistence_spec.rb
129
139
  - spec/diametric/query_spec.rb
130
140
  - spec/integration_spec.rb
141
+ - spec/peer_integration_spec.rb
131
142
  - spec/spec_helper.rb
143
+ - spec/support/gen_entity_class.rb
132
144
  - spec/support/persistence_examples.rb
133
- homepage: https://github.com/crnixon/diametric
145
+ homepage: https://github.com/relevance/diametric
134
146
  licenses: []
135
147
  post_install_message:
136
148
  rdoc_options: []
@@ -142,23 +154,34 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
154
  - - ! '>='
143
155
  - !ruby/object:Gem::Version
144
156
  version: '0'
157
+ segments:
158
+ - 0
159
+ hash: -448457445775991460
145
160
  required_rubygems_version: !ruby/object:Gem::Requirement
146
161
  none: false
147
162
  requirements:
148
163
  - - ! '>='
149
164
  - !ruby/object:Gem::Version
150
165
  version: '0'
166
+ segments:
167
+ - 0
168
+ hash: -448457445775991460
151
169
  requirements: []
152
170
  rubyforge_project:
153
- rubygems_version: 1.8.23
171
+ rubygems_version: 1.8.24
154
172
  signing_key:
155
173
  specification_version: 3
156
174
  summary: ActiveModel for Datomic
157
175
  test_files:
176
+ - spec/diametric/config_spec.rb
158
177
  - spec/diametric/entity_spec.rb
159
178
  - spec/diametric/persistence/peer_spec.rb
160
179
  - spec/diametric/persistence/rest_spec.rb
180
+ - spec/diametric/persistence_spec.rb
161
181
  - spec/diametric/query_spec.rb
162
182
  - spec/integration_spec.rb
183
+ - spec/peer_integration_spec.rb
163
184
  - spec/spec_helper.rb
185
+ - spec/support/gen_entity_class.rb
164
186
  - spec/support/persistence_examples.rb
187
+ has_rdoc:
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .jbundler
6
- .rspec
7
- .yardoc
8
- Gemfile.lock
9
- InstalledFiles
10
- _yardoc
11
- bin/
12
- coverage
13
- doc/
14
- lib/bundler/man
15
- pkg
16
- rdoc
17
- spec/reports
18
- test/tmp
19
- test/version_tmp
20
- tmp
21
- vendor/
22
- doc
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
data/TODO.org DELETED
@@ -1,12 +0,0 @@
1
- * Entity API
2
- ** Add default values to attributes
3
- ** People probably want validations by default: include ActiveModel::Validations
4
-
5
- * Persistence API
6
- ** Handle Java exceptions in the Peer persistence library
7
- ** Handle exceptions from the REST client in the REST persistence library
8
- ** Refactor so that Diametric::Persistence is the primary module and the connection determines different behavior
9
- *** Yoko requests: .connect should take an argument :rest or :peer, #peer? and #rest? methods should be on the connection object
10
-
11
- * History API
12
- ** Make it