chewy 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,6 +33,36 @@ describe Chewy::Type::Mapping do
33
33
  describe '.mappings_hash' do
34
34
  specify { Class.new(Chewy::Type::Base).mappings_hash.should == {} }
35
35
  specify { product.mappings_hash.should == product.root_object.mappings_hash }
36
+
37
+ context 'parent-child relationship' do
38
+ context do
39
+ before do
40
+ stub_index(:products) do
41
+ define_type :product do
42
+ root _parent: 'project', parent_id: -> { project_id } do
43
+ field :name, 'surname'
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ specify { product.mappings_hash[:product][:_parent].should == { type: 'project' } }
50
+ end
51
+
52
+ context do
53
+ before do
54
+ stub_index(:products) do
55
+ define_type :product do
56
+ root parent: {'type' => 'project'}, parent_id: -> { project_id } do
57
+ field :name, 'surname'
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ specify { product.mappings_hash[:product][:_parent].should == { 'type' => 'project' } }
64
+ end
65
+ end
36
66
  end
37
67
 
38
68
  context "no root element call" do
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'bundler'
2
2
  Bundler.require
3
-
3
+ require 'rspec/its'
4
+ require 'rspec/collection_matchers'
4
5
  require 'active_record'
5
6
  require 'database_cleaner'
6
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chewy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyromaniac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,14 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 2.14.0
33
+ version: 3.0.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 2.14.0
40
+ version: 3.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-its
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-collection_matchers
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: sqlite3
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -188,6 +216,7 @@ files:
188
216
  - lib/chewy/runtime.rb
189
217
  - lib/chewy/runtime/version.rb
190
218
  - lib/chewy/type.rb
219
+ - lib/chewy/type/actions.rb
191
220
  - lib/chewy/type/adapter/active_record.rb
192
221
  - lib/chewy/type/adapter/base.rb
193
222
  - lib/chewy/type/adapter/object.rb
@@ -197,6 +226,8 @@ files:
197
226
  - lib/chewy/type/observe.rb
198
227
  - lib/chewy/type/wrapper.rb
199
228
  - lib/chewy/version.rb
229
+ - lib/generators/chewy/install_generator.rb
230
+ - lib/generators/templates/chewy.yml
200
231
  - lib/tasks/chewy.rake
201
232
  - spec/chewy/config_spec.rb
202
233
  - spec/chewy/fields/base_spec.rb
@@ -231,6 +262,7 @@ files:
231
262
  - spec/chewy/rspec/update_index_spec.rb
232
263
  - spec/chewy/runtime/version_spec.rb
233
264
  - spec/chewy/runtime_spec.rb
265
+ - spec/chewy/type/actions_spec.rb
234
266
  - spec/chewy/type/adapter/active_record_spec.rb
235
267
  - spec/chewy/type/adapter/object_spec.rb
236
268
  - spec/chewy/type/import_spec.rb
@@ -300,6 +332,7 @@ test_files:
300
332
  - spec/chewy/rspec/update_index_spec.rb
301
333
  - spec/chewy/runtime/version_spec.rb
302
334
  - spec/chewy/runtime_spec.rb
335
+ - spec/chewy/type/actions_spec.rb
303
336
  - spec/chewy/type/adapter/active_record_spec.rb
304
337
  - spec/chewy/type/adapter/object_spec.rb
305
338
  - spec/chewy/type/import_spec.rb