fauna 0.0.0 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ class ClassValidationTest < MiniTest::Unit::TestCase
4
+ def test_validates_presence_of_field
5
+ h = Pigkeeper.new(:visited => nil)
6
+ refute h.valid?
7
+ refute h.save
8
+ assert_equal ["can't be blank"], h.errors[:visited],
9
+
10
+ h.visited = true
11
+ assert h.save
12
+ end
13
+
14
+ def test_validates_presence_of
15
+ h = Fauna::User.new(:email => email, :password => password)
16
+ refute h.valid?
17
+ refute h.save
18
+ assert_equal ["can't be blank"], h.errors[:name]
19
+
20
+ h.name = "Llyan"
21
+ assert h.save
22
+ end
23
+
24
+ def test_fails_save!
25
+ h = Pigkeeper.new(:visited => nil)
26
+ assert_raises(Fauna::Invalid) { h.save! }
27
+ end
28
+
29
+ def test_validate_callback
30
+ h = Pigkeeper.new(:visited => true, :pockets => 0)
31
+ refute h.valid?
32
+ refute h.save
33
+ assert_equal ["must be full of piggy treats"], h.errors[:pockets]
34
+
35
+ h.pockets = 1
36
+ assert h.save
37
+ end
38
+ end
@@ -0,0 +1,31 @@
1
+ require File.expand_path('../test_helper', __FILE__)
2
+
3
+ class ReadmeTest < MiniTest::Unit::TestCase
4
+ def test_readme
5
+ code = ""
6
+
7
+ sections = File.read(File.expand_path("../../README.md", __FILE__)).split("```")
8
+ sections.select do |text|
9
+ if text =~ /^ruby/
10
+ next if text =~ /ActionController|logger/
11
+ text.gsub!("publisher@example.com", FAUNA_TEST_EMAIL)
12
+ text.gsub!("secret", FAUNA_TEST_PASSWORD)
13
+ text.gsub!("Fauna.connection", "$fauna")
14
+ code << text[4..-1]
15
+ end
16
+ end
17
+
18
+ tmp = File.open("/tmp/fauna-ruby-readme-eval.rb", "w")
19
+ tmp.write(code)
20
+ tmp.close
21
+
22
+ begin
23
+ load tmp.path
24
+ rescue => e
25
+ puts e.inspect
26
+ puts e.backtrace
27
+ raise
28
+ end
29
+ File.delete(tmp.path)
30
+ end
31
+ end
@@ -0,0 +1,59 @@
1
+ libdir = File.dirname(File.dirname(__FILE__)) + '/lib'
2
+ $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
3
+
4
+ require "rubygems"
5
+ require "test/unit"
6
+ require "fauna"
7
+ require "securerandom"
8
+ require "mocha/setup"
9
+
10
+ FAUNA_TEST_EMAIL = ENV["FAUNA_TEST_EMAIL"]
11
+ FAUNA_TEST_PASSWORD = ENV["FAUNA_TEST_PASSWORD"]
12
+
13
+ if !(FAUNA_TEST_PASSWORD && FAUNA_TEST_PASSWORD)
14
+ raise "FAUNA_TEST_EMAIL and FAUNA_TEST_PASSWORD must be defined in your environment to run tests."
15
+ end
16
+
17
+ ROOT_CONNECTION = Fauna::Connection.new(:email => FAUNA_TEST_EMAIL, :password => FAUNA_TEST_PASSWORD)
18
+ ROOT_CONNECTION.delete("everything")
19
+
20
+ key = ROOT_CONNECTION.post("keys/publisher")['resource']['key']
21
+ PUBLISHER_CONNECTION = Fauna::Connection.new(:publisher_key => key)
22
+
23
+ key = ROOT_CONNECTION.post("keys/client")['resource']['key']
24
+ CLIENT_CONNECTION = Fauna::Connection.new(:client_key => key)
25
+
26
+ load "#{File.dirname(__FILE__)}/fixtures.rb"
27
+
28
+ Fauna::Client.context(PUBLISHER_CONNECTION) do
29
+ Fauna.migrate_schema!
30
+ end
31
+
32
+ class MiniTest::Unit::TestCase
33
+ def setup
34
+ @root_connection = ROOT_CONNECTION
35
+ @publisher_connection = PUBLISHER_CONNECTION
36
+ @client_connection = CLIENT_CONNECTION
37
+ Fauna::Client.push_context(@publisher_connection)
38
+ end
39
+
40
+ def teardown
41
+ Fauna::Client.pop_context
42
+ end
43
+
44
+ def email
45
+ "#{SecureRandom.random_number}@example.com"
46
+ end
47
+
48
+ def fail
49
+ assert false, "Not implemented"
50
+ end
51
+
52
+ def pass
53
+ assert true
54
+ end
55
+
56
+ def password
57
+ SecureRandom.random_number.to_s
58
+ end
59
+ end
metadata CHANGED
@@ -1,62 +1,246 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fauna
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 0
9
- version: 0.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
12
- - Fauna.org
7
+ authors:
8
+ - Fauna, Inc.
13
9
  autorequire:
14
10
  bindir: bin
15
- cert_chain: []
16
-
17
- date: 2012-12-10 00:00:00 -08:00
18
- default_executable:
19
- dependencies: []
20
-
21
- description: ""
22
- email: matt@fauna.org
11
+ cert_chain:
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMakNDQWhhZ0F3SUJB
14
+ Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE5TVEwd0N3WURWUVFEREFSbGRt
15
+ RnUKTVJnd0ZnWUtDWkltaVpQeUxHUUJHUllJWTJ4dmRXUmlkWEl4RWpBUUJn
16
+ b0praWFKay9Jc1pBRVpGZ0p6ZERBZQpGdzB3TnpBNU1UWXhNRE16TURCYUZ3
17
+ MHdPREE1TVRVeE1ETXpNREJhTUQweERUQUxCZ05WQkFNTUJHVjJZVzR4CkdE
18
+ QVdCZ29Ka2lhSmsvSXNaQUVaRmdoamJHOTFaR0oxY2pFU01CQUdDZ21TSm9t
19
+ VDhpeGtBUmtXQW5OME1JSUIKSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4
20
+ QU1JSUJDZ0tDQVFFQTVDMElvODlueUFwbnIrUHZiTkZnZTlWcwp5UldBbEdC
21
+ VUVNYWhwWHAyOFZycmZYWlQwckFXN0pCbzRQbENFM2psNG5FNGR6RTZnQWRJ
22
+ dFN5Y2pUb3NydzdBCklyNSt4b3lsNFZiMzVhZHY1NlRJUVFYdk56K0J6bHFu
23
+ a0FZNUpOMENTQlJUUWI2bXh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ruby/object:Gem::Dependency
42
+ name: activemodel
43
+ requirement: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: activesupport
59
+ requirement: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: rest-client
75
+ requirement: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ type: :runtime
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: json
91
+ requirement: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ - !ruby/object:Gem::Dependency
106
+ name: mocha
107
+ requirement: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ type: :development
114
+ prerelease: false
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ - !ruby/object:Gem::Dependency
122
+ name: echoe
123
+ requirement: !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ type: :development
130
+ prerelease: false
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: minitest
139
+ requirement: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ! '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Official Ruby client for the Fauna API.
154
+ email: ''
23
155
  executables: []
24
-
25
156
  extensions: []
26
-
27
- extra_rdoc_files: []
28
-
29
- files: []
30
-
31
- has_rdoc: true
32
- homepage: https://fauna.org
157
+ extra_rdoc_files:
158
+ - CHANGELOG
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fauna.rb
162
+ - lib/fauna/client.rb
163
+ - lib/fauna/connection.rb
164
+ - lib/fauna/ddl.rb
165
+ - lib/fauna/model.rb
166
+ - lib/fauna/model/class.rb
167
+ - lib/fauna/model/follow.rb
168
+ - lib/fauna/model/publisher.rb
169
+ - lib/fauna/model/timeline.rb
170
+ - lib/fauna/model/user.rb
171
+ - lib/fauna/rails.rb
172
+ - lib/fauna/resource.rb
173
+ files:
174
+ - CHANGELOG
175
+ - Gemfile
176
+ - LICENSE
177
+ - Manifest
178
+ - README.md
179
+ - Rakefile
180
+ - fauna.gemspec
181
+ - lib/fauna.rb
182
+ - lib/fauna/client.rb
183
+ - lib/fauna/connection.rb
184
+ - lib/fauna/ddl.rb
185
+ - lib/fauna/model.rb
186
+ - lib/fauna/model/class.rb
187
+ - lib/fauna/model/follow.rb
188
+ - lib/fauna/model/publisher.rb
189
+ - lib/fauna/model/timeline.rb
190
+ - lib/fauna/model/user.rb
191
+ - lib/fauna/rails.rb
192
+ - lib/fauna/resource.rb
193
+ - test/client_test.rb
194
+ - test/connection_test.rb
195
+ - test/fixtures.rb
196
+ - test/model/association_test.rb
197
+ - test/model/class_test.rb
198
+ - test/model/follow_test.rb
199
+ - test/model/publisher_test.rb
200
+ - test/model/timeline_test.rb
201
+ - test/model/user_test.rb
202
+ - test/model/validation_test.rb
203
+ - test/readme_test.rb
204
+ - test/test_helper.rb
205
+ homepage: http://fauna.github.com/fauna/
33
206
  licenses: []
34
-
35
207
  post_install_message:
36
- rdoc_options: []
37
-
38
- require_paths:
208
+ rdoc_options:
209
+ - --line-numbers
210
+ - --inline-source
211
+ - --title
212
+ - Fauna
213
+ - --main
214
+ - README.md
215
+ require_paths:
39
216
  - lib
40
- required_ruby_version: !ruby/object:Gem::Requirement
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- segments:
45
- - 0
46
- version: "0"
47
- required_rubygems_version: !ruby/object:Gem::Requirement
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- segments:
52
- - 0
53
- version: "0"
217
+ required_ruby_version: !ruby/object:Gem::Requirement
218
+ none: false
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
224
+ none: false
225
+ requirements:
226
+ - - ! '>='
227
+ - !ruby/object:Gem::Version
228
+ version: '1.2'
54
229
  requirements: []
55
-
56
- rubyforge_project:
57
- rubygems_version: 1.3.6
230
+ rubyforge_project: fauna
231
+ rubygems_version: 1.8.23
58
232
  signing_key:
59
233
  specification_version: 3
60
- summary: ""
61
- test_files: []
62
-
234
+ summary: Official Ruby client for the Fauna API.
235
+ test_files:
236
+ - test/client_test.rb
237
+ - test/connection_test.rb
238
+ - test/model/association_test.rb
239
+ - test/model/class_test.rb
240
+ - test/model/follow_test.rb
241
+ - test/model/publisher_test.rb
242
+ - test/model/timeline_test.rb
243
+ - test/model/user_test.rb
244
+ - test/model/validation_test.rb
245
+ - test/readme_test.rb
246
+ - test/test_helper.rb
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ U7����bf��q��u��D�G����,q�Z�8u6����*����Қ�_�ļ�k/ؑ��.qg�����l�="͏�I+]=\c�