neoid 0.0.51 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'fileutils'
3
2
 
4
3
  describe Neoid::ModelAdditions do
5
4
  context "search" do
@@ -1,5 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Neoid do
4
-
4
+ context "subrefs" do
5
+ it "should create all subrefs on initialization" do
6
+ Neoid.node_models.each do |klass|
7
+ klass.instance_variable_get(:@neo_subref_node).should_not be_nil
8
+ end
9
+ end
10
+ end
5
11
  end
@@ -3,6 +3,8 @@ require 'active_record'
3
3
  require 'neography'
4
4
  require 'rest-client'
5
5
 
6
+ # ENV['NEOID_LOG'] = 'true'
7
+
6
8
  uri = URI.parse(ENV["NEO4J_URL"] ? ENV["NEO4J_URL"] : ENV['TRAVIS'] ? "http://localhost:7474" : "http://localhost:7574")
7
9
  $neo = Neography::Rest.new(uri.to_s)
8
10
 
@@ -19,9 +21,15 @@ end
19
21
 
20
22
  Neoid.db = $neo
21
23
 
24
+ logger, ActiveRecord::Base.logger = ActiveRecord::Base.logger, Logger.new('/dev/null')
22
25
  ActiveRecord::Base.configurations = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'support/database.yml')))
23
26
  ActiveRecord::Base.establish_connection('sqlite3')
24
27
 
28
+ require 'support/schema'
29
+ require 'support/models'
30
+
31
+ ActiveRecord::Base.logger = logger
32
+
25
33
  RSpec.configure do |config|
26
34
  config.mock_with :rspec
27
35
 
@@ -29,16 +37,10 @@ RSpec.configure do |config|
29
37
  end
30
38
 
31
39
  config.before(:each) do
32
- Neoid.reset_cached_variables
33
- end
34
-
35
- config.before(:each) do
40
+ Neoid.node_models.each(&:destroy_all)
36
41
  Neoid.clean_db(:yes_i_am_sure)
37
- Neoid.models.each(&:destroy_all)
42
+ Neoid.reset_cached_variables
38
43
  end
39
44
  end
40
45
 
41
- require 'support/schema'
42
- require 'support/models'
43
-
44
- Neoid.initialize_all
46
+ Neoid.initialize_all
@@ -12,6 +12,7 @@ class User < ActiveRecord::Base
12
12
 
13
13
  def like!(movie)
14
14
  movies << movie unless likes?(movie)
15
+ likes.where(movie_id: movie.id).first
15
16
  end
16
17
 
17
18
  def unlike!(movie)
@@ -52,7 +53,7 @@ end
52
53
  class UserFollow < ActiveRecord::Base
53
54
  include ActiveModel::Validations::Callbacks
54
55
 
55
- belongs_to :user, dependent: :destroy
56
+ belongs_to :user
56
57
  belongs_to :item, polymorphic: true
57
58
 
58
59
  include Neoid::Relationship
@@ -65,8 +66,8 @@ end
65
66
  class Like < ActiveRecord::Base
66
67
  include ActiveModel::Validations::Callbacks
67
68
 
68
- belongs_to :user, dependent: :destroy
69
- belongs_to :movie, dependent: :destroy
69
+ belongs_to :user
70
+ belongs_to :movie
70
71
 
71
72
  include Neoid::Relationship
72
73
 
@@ -95,3 +96,11 @@ class Article < ActiveRecord::Base
95
96
  end
96
97
  end
97
98
  end
99
+
100
+ class NoAutoIndexNode < ActiveRecord::Base
101
+ include ActiveModel::Validations::Callbacks
102
+ include Neoid::Node
103
+ neoidable auto_index: false do |c|
104
+ c.field :name
105
+ end
106
+ end
@@ -37,4 +37,8 @@ ActiveRecord::Schema.define :version => 0 do
37
37
 
38
38
  t.timestamps
39
39
  end
40
+
41
+ create_table :no_auto_index_nodes do |t|
42
+ t.string :name
43
+ end
40
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.51
4
+ version: '0.1'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-30 00:00:00.000000000 Z
12
+ date: 2013-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -125,6 +125,8 @@ files:
125
125
  - Rakefile
126
126
  - TODO.md
127
127
  - lib/neoid.rb
128
+ - lib/neoid/batch.rb
129
+ - lib/neoid/config.rb
128
130
  - lib/neoid/database_cleaner.rb
129
131
  - lib/neoid/middleware.rb
130
132
  - lib/neoid/model_additions.rb
@@ -135,6 +137,8 @@ files:
135
137
  - lib/neoid/search_session.rb
136
138
  - lib/neoid/version.rb
137
139
  - neoid.gemspec
140
+ - spec/neoid/batch_spec.rb
141
+ - spec/neoid/config_spec.rb
138
142
  - spec/neoid/model_additions_spec.rb
139
143
  - spec/neoid/model_config_spec.rb
140
144
  - spec/neoid/search_spec.rb
@@ -168,6 +172,8 @@ signing_key:
168
172
  specification_version: 3
169
173
  summary: Neo4j for ActiveRecord
170
174
  test_files:
175
+ - spec/neoid/batch_spec.rb
176
+ - spec/neoid/config_spec.rb
171
177
  - spec/neoid/model_additions_spec.rb
172
178
  - spec/neoid/model_config_spec.rb
173
179
  - spec/neoid/search_spec.rb