mongoid_nested_set 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,18 +1,19 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "mongoid", ">= 2.0.0.beta.20"
3
+ gem "mongoid", ">= 2.1.0"
4
4
 
5
5
  # Add dependencies to develop your gem here.
6
6
  # Include everything needed to run rake, tests, features, etc.
7
7
  group :development do
8
- gem "bundler", "~> 1.0.0"
9
- gem "jeweler", "~> 1.5.1"
8
+ gem "bundler", "~> 1.0"
9
+ gem "jeweler", "~> 1.5"
10
10
  gem "rcov", ">= 0"
11
- gem 'rspec-core'
11
+ gem 'rspec-core', "~> 2.0"
12
+ gem 'rdoc'
12
13
  end
13
14
 
14
15
  group :test do
15
- gem 'rspec-expectations'
16
+ gem 'rspec-expectations', "~> 2.0"
16
17
  gem 'rr'
17
18
  gem 'remarkable_mongoid'
18
19
  gem 'database_cleaner'
data/Gemfile.lock CHANGED
@@ -1,59 +1,59 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (3.0.3)
5
- activesupport (= 3.0.3)
4
+ activemodel (3.0.10)
5
+ activesupport (= 3.0.10)
6
6
  builder (~> 2.1.2)
7
- i18n (~> 0.4)
8
- activesupport (3.0.3)
9
- bson (1.1.4)
7
+ i18n (~> 0.5.0)
8
+ activesupport (3.0.10)
9
+ bson (1.3.1)
10
10
  builder (2.1.2)
11
- database_cleaner (0.6.0)
11
+ database_cleaner (0.6.7)
12
12
  diff-lcs (1.1.2)
13
13
  git (1.2.5)
14
14
  i18n (0.5.0)
15
- jeweler (1.5.1)
16
- bundler (~> 1.0.0)
15
+ jeweler (1.6.4)
16
+ bundler (~> 1.0)
17
17
  git (>= 1.2.5)
18
18
  rake
19
- mongo (1.1.4)
20
- bson (>= 1.1.1)
21
- mongoid (2.0.0.beta.20)
19
+ mongo (1.3.1)
20
+ bson (>= 1.3.1)
21
+ mongoid (2.1.9)
22
22
  activemodel (~> 3.0)
23
- mongo (~> 1.1)
23
+ mongo (~> 1.3)
24
24
  tzinfo (~> 0.3.22)
25
- will_paginate (~> 3.0.pre)
26
- rake (0.8.7)
27
- rcov (0.9.9)
25
+ rake (0.9.2)
26
+ rcov (0.9.10)
27
+ rdoc (3.9.4)
28
28
  remarkable (4.0.0.alpha4)
29
29
  rspec (>= 2.0.0.alpha11)
30
30
  remarkable_activemodel (4.0.0.alpha4)
31
31
  remarkable (~> 4.0.0.alpha4)
32
32
  rspec (>= 2.0.0.alpha11)
33
- remarkable_mongoid (0.5.0)
34
- remarkable_activemodel (>= 4.0.0.alpha2)
35
- rr (1.0.2)
36
- rspec (2.2.0)
37
- rspec-core (~> 2.2)
38
- rspec-expectations (~> 2.2)
39
- rspec-mocks (~> 2.2)
40
- rspec-core (2.2.1)
41
- rspec-expectations (2.2.0)
33
+ remarkable_mongoid (0.6.0)
34
+ remarkable_activemodel (~> 4.0.0.alpha4)
35
+ rr (1.0.3)
36
+ rspec (2.6.0)
37
+ rspec-core (~> 2.6.0)
38
+ rspec-expectations (~> 2.6.0)
39
+ rspec-mocks (~> 2.6.0)
40
+ rspec-core (2.6.4)
41
+ rspec-expectations (2.6.0)
42
42
  diff-lcs (~> 1.1.2)
43
- rspec-mocks (2.2.0)
44
- tzinfo (0.3.23)
45
- will_paginate (3.0.pre2)
43
+ rspec-mocks (2.6.0)
44
+ tzinfo (0.3.29)
46
45
 
47
46
  PLATFORMS
48
47
  ruby
49
48
 
50
49
  DEPENDENCIES
51
- bundler (~> 1.0.0)
50
+ bundler (~> 1.0)
52
51
  database_cleaner
53
- jeweler (~> 1.5.1)
54
- mongoid (>= 2.0.0.beta.20)
52
+ jeweler (~> 1.5)
53
+ mongoid (>= 2.1.0)
55
54
  rcov
55
+ rdoc
56
56
  remarkable_mongoid
57
57
  rr
58
- rspec-core
59
- rspec-expectations
58
+ rspec-core (~> 2.0)
59
+ rspec-expectations (~> 2.0)
data/README.markdown CHANGED
@@ -22,7 +22,7 @@ Install as Gem
22
22
 
23
23
  via Gemfile
24
24
 
25
- gem 'mongoid_nested_set', '0.1.0'
25
+ gem 'mongoid_nested_set', '0.1.3'
26
26
 
27
27
 
28
28
  ## Usage
data/Rakefile CHANGED
@@ -34,8 +34,8 @@ end
34
34
 
35
35
  task :default => :spec
36
36
 
37
- require 'rake/rdoctask'
38
- Rake::RDocTask.new do |rdoc|
37
+ require 'rdoc/task'
38
+ RDoc::Task.new do |rdoc|
39
39
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
40
 
41
41
  rdoc.rdoc_dir = 'rdoc'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -45,10 +45,10 @@ module Mongoid::Acts::NestedSet
45
45
 
46
46
  field left_field_name, :type => Integer
47
47
  field right_field_name, :type => Integer
48
- field outline_number_field_name if outline_number_field_name
48
+ field outline_number_field_name, :type => String if outline_number_field_name
49
49
  field :depth, :type => Integer
50
50
 
51
- references_many :children, :class_name => self.name, :foreign_key => parent_field_name, :inverse_of => :parent, :default_order => criteria.asc(left_field_name)
51
+ references_many :children, :class_name => self.name, :foreign_key => parent_field_name, :inverse_of => :parent, :order => criteria.asc(left_field_name)
52
52
  referenced_in :parent, :class_name => self.name, :foreign_key => parent_field_name
53
53
 
54
54
  attr_accessor :skip_before_destroy
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid_nested_set}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Brandon Turner"]
12
- s.date = %q{2010-12-29}
11
+ s.authors = [%q{Brandon Turner}]
12
+ s.date = %q{2011-08-26}
13
13
  s.description = %q{Fully featured tree implementation for Mongoid using the nested set model}
14
14
  s.email = %q{bturner@bltweb.net}
15
15
  s.extra_rdoc_files = [
@@ -50,48 +50,36 @@ Gem::Specification.new do |s|
50
50
  "spec/spec_helper.rb"
51
51
  ]
52
52
  s.homepage = %q{http://github.com/thinkwell/mongoid_nested_set}
53
- s.licenses = ["MIT"]
54
- s.require_paths = ["lib"]
55
- s.rubygems_version = %q{1.3.7}
53
+ s.licenses = [%q{MIT}]
54
+ s.require_paths = [%q{lib}]
55
+ s.rubygems_version = %q{1.8.6}
56
56
  s.summary = %q{Nested set based tree implementation for Mongoid}
57
- s.test_files = [
58
- "spec/matchers/nestedset_pos.rb",
59
- "spec/models/circle_node.rb",
60
- "spec/models/node.rb",
61
- "spec/models/node_without_nested_set.rb",
62
- "spec/models/numbering_node.rb",
63
- "spec/models/renamed_fields.rb",
64
- "spec/models/shape_node.rb",
65
- "spec/models/square_node.rb",
66
- "spec/models/test_document.rb",
67
- "spec/models/unscoped_node.rb",
68
- "spec/mongoid_nested_set_spec.rb",
69
- "spec/spec_helper.rb"
70
- ]
71
57
 
72
58
  if s.respond_to? :specification_version then
73
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
74
59
  s.specification_version = 3
75
60
 
76
61
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
77
- s.add_runtime_dependency(%q<mongoid>, [">= 2.0.0.beta.20"])
78
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
79
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
62
+ s.add_runtime_dependency(%q<mongoid>, [">= 2.1.0"])
63
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
64
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5"])
80
65
  s.add_development_dependency(%q<rcov>, [">= 0"])
81
- s.add_development_dependency(%q<rspec-core>, [">= 0"])
66
+ s.add_development_dependency(%q<rspec-core>, ["~> 2.0"])
67
+ s.add_development_dependency(%q<rdoc>, [">= 0"])
82
68
  else
83
- s.add_dependency(%q<mongoid>, [">= 2.0.0.beta.20"])
84
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
85
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
69
+ s.add_dependency(%q<mongoid>, [">= 2.1.0"])
70
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
71
+ s.add_dependency(%q<jeweler>, ["~> 1.5"])
86
72
  s.add_dependency(%q<rcov>, [">= 0"])
87
- s.add_dependency(%q<rspec-core>, [">= 0"])
73
+ s.add_dependency(%q<rspec-core>, ["~> 2.0"])
74
+ s.add_dependency(%q<rdoc>, [">= 0"])
88
75
  end
89
76
  else
90
- s.add_dependency(%q<mongoid>, [">= 2.0.0.beta.20"])
91
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
92
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
77
+ s.add_dependency(%q<mongoid>, [">= 2.1.0"])
78
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
79
+ s.add_dependency(%q<jeweler>, ["~> 1.5"])
93
80
  s.add_dependency(%q<rcov>, [">= 0"])
94
- s.add_dependency(%q<rspec-core>, [">= 0"])
81
+ s.add_dependency(%q<rspec-core>, ["~> 2.0"])
82
+ s.add_dependency(%q<rdoc>, [">= 0"])
95
83
  end
96
84
  end
97
85
 
@@ -21,10 +21,11 @@ module Mongoid::Acts::NestedSet
21
21
 
22
22
  def test_set_attributes(attrs)
23
23
  attrs.each do |key, val|
24
+ key = key.to_s
24
25
  if Mongoid.allow_dynamic_fields ||
25
- fields.keys.any? { |k| k.to_s == key.to_s } ||
26
- associations.any? { |a| a[0].to_s == key.to_s || a[1].foreign_key.to_s == key.to_s }
27
- @attributes[key] = val
26
+ fields.keys.any? { |k| k.to_s == key } ||
27
+ associations.any? { |a| a[0].to_s == key || a[1].foreign_key.to_s == key }
28
+ @attributes[key] = self.typed_value_for(key, val)
28
29
  end
29
30
  end
30
31
  self
@@ -147,9 +147,10 @@ describe "A Mongoid::Document" do
147
147
  end
148
148
 
149
149
  it "has a parent field" do
150
- Node.should have_field('parent_id', :type => String)
151
- RenamedFields.should have_field('mother_id', :type => String)
152
- RenamedFields.should_not have_field('parent_id', :type => String)
150
+ # Starting in Mongoid 2.0.rc1, all foreign keys are Objects
151
+ Node.should have_field('parent_id', :type => Object)
152
+ RenamedFields.should have_field('mother_id', :type => Object)
153
+ RenamedFields.should_not have_field('parent_id', :type => Object)
153
154
  end
154
155
 
155
156
  it "does not have a number field" do
@@ -684,7 +685,7 @@ describe "A Mongoid::Document" do
684
685
  NumberingNode.should respond_to('each_with_outline_number')
685
686
  end
686
687
 
687
- it "does not have a number field" do
688
+ it "has a number field" do
688
689
  NumberingNode.should have_field('number', :type => String)
689
690
  end
690
691
 
data/spec/spec_helper.rb CHANGED
@@ -26,7 +26,7 @@ Mongoid.configure do |config|
26
26
  end
27
27
 
28
28
  RSpec.configure do |config|
29
- config.mock_with RR::Adapters::Rspec
29
+ config.mock_with :rr
30
30
  config.include(Mongoid::Acts::NestedSet::Matchers)
31
31
 
32
32
  config.before(:suite) do
metadata CHANGED
@@ -1,105 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mongoid_nested_set
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 2
9
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Brandon Turner
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-12-29 00:00:00 -06:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-26 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: mongoid
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &25185020 !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 0
30
- - 0
31
- - beta
32
- - 20
33
- version: 2.0.0.beta.20
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.1.0
34
22
  type: :runtime
35
23
  prerelease: false
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *25185020
25
+ - !ruby/object:Gem::Dependency
38
26
  name: bundler
39
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ requirement: &25184540 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- segments:
45
- - 1
46
- - 0
47
- - 0
48
- version: 1.0.0
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
49
33
  type: :development
50
34
  prerelease: false
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *25184540
36
+ - !ruby/object:Gem::Dependency
53
37
  name: jeweler
54
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &25184060 !ruby/object:Gem::Requirement
55
39
  none: false
56
- requirements:
40
+ requirements:
57
41
  - - ~>
58
- - !ruby/object:Gem::Version
59
- segments:
60
- - 1
61
- - 5
62
- - 1
63
- version: 1.5.1
42
+ - !ruby/object:Gem::Version
43
+ version: '1.5'
64
44
  type: :development
65
45
  prerelease: false
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *25184060
47
+ - !ruby/object:Gem::Dependency
68
48
  name: rcov
69
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ requirement: &25183200 !ruby/object:Gem::Requirement
70
50
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- segments:
75
- - 0
76
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
77
55
  type: :development
78
56
  prerelease: false
79
- version_requirements: *id004
80
- - !ruby/object:Gem::Dependency
57
+ version_requirements: *25183200
58
+ - !ruby/object:Gem::Dependency
81
59
  name: rspec-core
82
- requirement: &id005 !ruby/object:Gem::Requirement
60
+ requirement: &25182460 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '2.0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *25182460
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: &25070500 !ruby/object:Gem::Requirement
83
72
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
90
77
  type: :development
91
78
  prerelease: false
92
- version_requirements: *id005
79
+ version_requirements: *25070500
93
80
  description: Fully featured tree implementation for Mongoid using the nested set model
94
81
  email: bturner@bltweb.net
95
82
  executables: []
96
-
97
83
  extensions: []
98
-
99
- extra_rdoc_files:
84
+ extra_rdoc_files:
100
85
  - LICENSE.txt
101
86
  - README.markdown
102
- files:
87
+ files:
103
88
  - .document
104
89
  - .rspec
105
90
  - Gemfile
@@ -131,49 +116,32 @@ files:
131
116
  - spec/models/unscoped_node.rb
132
117
  - spec/mongoid_nested_set_spec.rb
133
118
  - spec/spec_helper.rb
134
- has_rdoc: true
135
119
  homepage: http://github.com/thinkwell/mongoid_nested_set
136
- licenses:
120
+ licenses:
137
121
  - MIT
138
122
  post_install_message:
139
123
  rdoc_options: []
140
-
141
- require_paths:
124
+ require_paths:
142
125
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
126
+ required_ruby_version: !ruby/object:Gem::Requirement
144
127
  none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: -1884730706523752762
149
- segments:
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ segments:
150
133
  - 0
151
- version: "0"
152
- required_rubygems_version: !ruby/object:Gem::Requirement
134
+ hash: -922553073555053444
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
136
  none: false
154
- requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- segments:
158
- - 0
159
- version: "0"
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
160
141
  requirements: []
161
-
162
142
  rubyforge_project:
163
- rubygems_version: 1.3.7
143
+ rubygems_version: 1.8.6
164
144
  signing_key:
165
145
  specification_version: 3
166
146
  summary: Nested set based tree implementation for Mongoid
167
- test_files:
168
- - spec/matchers/nestedset_pos.rb
169
- - spec/models/circle_node.rb
170
- - spec/models/node.rb
171
- - spec/models/node_without_nested_set.rb
172
- - spec/models/numbering_node.rb
173
- - spec/models/renamed_fields.rb
174
- - spec/models/shape_node.rb
175
- - spec/models/square_node.rb
176
- - spec/models/test_document.rb
177
- - spec/models/unscoped_node.rb
178
- - spec/mongoid_nested_set_spec.rb
179
- - spec/spec_helper.rb
147
+ test_files: []