hydra_attribute 0.4.0.rc1 → 0.4.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,14 +25,11 @@ describe HydraAttribute::HydraMethods do
25
25
  let!(:hydra_attribute2) { Product.hydra_attributes.create(name: 'b', backend_type: 'string') }
26
26
 
27
27
  it 'should return hydra attribute ids for specific hydra set' do
28
- Product.hydra_set_attribute_ids(hydra_set.id).should have(1).hydra_attribute
29
- Product.hydra_set_attribute_ids(hydra_set.id).first.should == hydra_attribute1.id
28
+ Product.hydra_set_attribute_ids(hydra_set.id).should == [hydra_attribute1.id]
30
29
  end
31
30
 
32
31
  it 'should return all hydra attribute ids if hydra set does not exist' do
33
- Product.hydra_set_attribute_ids(0).should have(2).hydra_attributes
34
- Product.hydra_set_attribute_ids(0).first.should == hydra_attribute1.id
35
- Product.hydra_set_attribute_ids(0).last.should == hydra_attribute2.id
32
+ Product.hydra_set_attribute_ids(0).should =~ [hydra_attribute1.id, hydra_attribute2.id]
36
33
  end
37
34
  end
38
35
 
@@ -75,14 +72,11 @@ describe HydraAttribute::HydraMethods do
75
72
  let!(:hydra_attribute2) { Product.hydra_attributes.create(name: 'b', backend_type: 'string') }
76
73
 
77
74
  it 'should return hydra attribute names for specific hydra set' do
78
- Product.hydra_set_attribute_names(hydra_set.id).should have(1).hydra_attribute
79
- Product.hydra_set_attribute_names(hydra_set.id).first.should == hydra_attribute1.name
75
+ Product.hydra_set_attribute_names(hydra_set.id).should == [hydra_attribute1.name]
80
76
  end
81
77
 
82
78
  it 'should return all hydra attribute names if hydra set does not exist' do
83
- Product.hydra_set_attribute_names(0).should have(2).hydra_attributes
84
- Product.hydra_set_attribute_names(0).first.should == hydra_attribute1.name
85
- Product.hydra_set_attribute_names(0).last.should == hydra_attribute2.name
79
+ Product.hydra_set_attribute_names(0).should =~ [hydra_attribute1.name, hydra_attribute2.name]
86
80
  end
87
81
  end
88
82
 
@@ -124,15 +118,20 @@ describe HydraAttribute::HydraMethods do
124
118
  let!(:hydra_attribute1) { hydra_set.hydra_attributes.create(name: 'a', backend_type: 'string') }
125
119
  let!(:hydra_attribute2) { Product.hydra_attributes.create(name: 'b', backend_type: 'integer') }
126
120
 
127
- it 'should return hydra attribute names for specific hydra set' do
128
- Product.hydra_set_attribute_backend_types(hydra_set.id).should have(1).hydra_attribute
129
- Product.hydra_set_attribute_backend_types(hydra_set.id).first.should == hydra_attribute1.backend_type
121
+ it 'should return hydra attribute backend types for specific hydra set' do
122
+ Product.hydra_set_attribute_backend_types(hydra_set.id).should == [hydra_attribute1.backend_type]
130
123
  end
131
124
 
132
- it 'should return all hydra attribute names if hydra set does not exist' do
133
- Product.hydra_set_attribute_backend_types(0).should have(2).hydra_attributes
134
- Product.hydra_set_attribute_backend_types(0).first.should == hydra_attribute1.backend_type
135
- Product.hydra_set_attribute_backend_types(0).last.should == hydra_attribute2.backend_type
125
+ it 'should return all hydra attribute backend types if hydra set does not exist' do
126
+ Product.hydra_set_attribute_backend_types(0).should =~ [hydra_attribute1.backend_type, hydra_attribute2.backend_type]
127
+ end
128
+
129
+ it 'should return uniq attribute backend type names' do
130
+ hydra_set.hydra_attributes.create(name: 'c', backend_type: 'string')
131
+ hydra_set.hydra_attributes.create(name: 'd', backend_type: 'integer')
132
+
133
+ backend_types = Product.hydra_set_attribute_backend_types(hydra_set.id)
134
+ backend_types.should =~ %w(string integer)
136
135
  end
137
136
  end
138
137
 
@@ -353,8 +352,8 @@ describe HydraAttribute::HydraMethods do
353
352
 
354
353
  describe 'hydra set does not exist' do
355
354
  it 'should return all hydra attributes for specific backend type' do
356
- Product.hydra_set_attributes_for_backend_type(0, 'string').should =~ [hydra_attr1, hydra_attr2]
357
- Product.hydra_set_attributes_for_backend_type(0, 'integer').should =~ [hydra_attr3, hydra_attr4]
355
+ Product.hydra_set_attributes_for_backend_type(0, 'string').should =~ [hydra_attr1, hydra_attr2]
356
+ Product.hydra_set_attributes_for_backend_type(0, 'integer').should =~ [hydra_attr3, hydra_attr4]
358
357
  end
359
358
 
360
359
  it 'should return blank array if there are not any hydra attributes' do
@@ -383,8 +382,8 @@ describe HydraAttribute::HydraMethods do
383
382
 
384
383
  describe 'hydra set does not exist' do
385
384
  it 'should return all hydra attribute ids for specific backend type' do
386
- Product.hydra_set_attribute_ids_for_backend_type(0, 'string').should =~ [hydra_attr1.id, hydra_attr2.id]
387
- Product.hydra_set_attribute_ids_for_backend_type(0, 'integer').should =~ [hydra_attr3.id, hydra_attr4.id]
385
+ Product.hydra_set_attribute_ids_for_backend_type(0, 'string').should =~ [hydra_attr1.id, hydra_attr2.id]
386
+ Product.hydra_set_attribute_ids_for_backend_type(0, 'integer').should =~ [hydra_attr3.id, hydra_attr4.id]
388
387
  end
389
388
 
390
389
  it 'should return blank array if there are not any hydra attributes' do
@@ -413,8 +412,8 @@ describe HydraAttribute::HydraMethods do
413
412
 
414
413
  describe 'hydra set does not exist' do
415
414
  it 'should return all hydra attribute names for specific backend type' do
416
- Product.hydra_set_attribute_names_for_backend_type(0, 'string').should =~ [hydra_attr1.name, hydra_attr2.name]
417
- Product.hydra_set_attribute_names_for_backend_type(0, 'integer').should =~ [hydra_attr3.name, hydra_attr4.name]
415
+ Product.hydra_set_attribute_names_for_backend_type(0, 'string').should =~ [hydra_attr1.name, hydra_attr2.name]
416
+ Product.hydra_set_attribute_names_for_backend_type(0, 'integer').should =~ [hydra_attr3.name, hydra_attr4.name]
418
417
  end
419
418
 
420
419
  it 'should return blank array if there are not any hydra attributes' do
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe HydraAttribute::Memoize do
3
+ describe HydraAttribute::Memoizable do
4
4
  def anonymous(arity = 0)
5
5
  params = (1..arity).map{ |i| "a#{i}" }.join(', ')
6
6
 
7
7
  anonymous = Class.new do
8
- extend HydraAttribute::Memoize
8
+ extend HydraAttribute::Memoizable
9
9
 
10
10
  class_eval <<-EOS, __FILE__, __LINE__ + 1
11
11
  def my_method(#{params})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.rc1
4
+ version: 0.4.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-03 00:00:00.000000000Z
12
+ date: 2012-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &2156441720 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156441720
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &2156436880 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *2156436880
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: cucumber
38
- requirement: &2156427620 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2156427620
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: sqlite3
49
- requirement: &2156426920 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *2156426920
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: database_cleaner
60
- requirement: &2156425880 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *2156425880
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: appraisal
71
- requirement: &2156421380 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *2156421380
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: rake
82
- requirement: &2156408820 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,7 +117,12 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *2156408820
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  description: hydra_attribute is an implementation of EAV pattern for ActiveRecord
92
127
  models.
93
128
  email: kostya.stepanyuk@gmail.com
@@ -152,19 +187,20 @@ files:
152
187
  - lib/hydra_attribute/hydra_set.rb
153
188
  - lib/hydra_attribute/hydra_set_methods.rb
154
189
  - lib/hydra_attribute/hydra_value_methods.rb
155
- - lib/hydra_attribute/memoize.rb
190
+ - lib/hydra_attribute/memoizable.rb
156
191
  - lib/hydra_attribute/migrator.rb
157
192
  - lib/hydra_attribute/railtie.rb
158
193
  - lib/hydra_attribute/version.rb
159
194
  - lib/rails/generators/hydra_attribute/install/USAGE
160
195
  - lib/rails/generators/hydra_attribute/install/install_generator.rb
161
196
  - lib/rails/generators/hydra_attribute/install/templates/hydra_attribute.txt
162
- - spec/hydra_attribute_methods_spec.rb
163
- - spec/hydra_attribute_spec.rb
164
- - spec/hydra_methods_spec.rb
165
- - spec/hydra_set_methods_spec.rb
166
- - spec/hydra_set_spec.rb
167
- - spec/memoize_spec.rb
197
+ - spec/hydra_attribute/active_record/attribute_methods_spec.rb
198
+ - spec/hydra_attribute/hydra_attribute_methods_spec.rb
199
+ - spec/hydra_attribute/hydra_attribute_spec.rb
200
+ - spec/hydra_attribute/hydra_methods_spec.rb
201
+ - spec/hydra_attribute/hydra_set_methods_spec.rb
202
+ - spec/hydra_attribute/hydra_set_spec.rb
203
+ - spec/hydra_attribute/memoizable_spec.rb
168
204
  - spec/spec_helper.rb
169
205
  homepage: https://github.com/kostyantyn/hydra_attribute
170
206
  licenses: []
@@ -186,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
222
  version: 1.3.1
187
223
  requirements: []
188
224
  rubyforge_project:
189
- rubygems_version: 1.8.10
225
+ rubygems_version: 1.8.24
190
226
  signing_key:
191
227
  specification_version: 3
192
228
  summary: hydra_attribute is an implementation of EAV pattern for ActiveRecord models.
@@ -218,10 +254,11 @@ test_files:
218
254
  - gemfiles/3.1.gemfile.lock
219
255
  - gemfiles/3.2.gemfile
220
256
  - gemfiles/3.2.gemfile.lock
221
- - spec/hydra_attribute_methods_spec.rb
222
- - spec/hydra_attribute_spec.rb
223
- - spec/hydra_methods_spec.rb
224
- - spec/hydra_set_methods_spec.rb
225
- - spec/hydra_set_spec.rb
226
- - spec/memoize_spec.rb
257
+ - spec/hydra_attribute/active_record/attribute_methods_spec.rb
258
+ - spec/hydra_attribute/hydra_attribute_methods_spec.rb
259
+ - spec/hydra_attribute/hydra_attribute_spec.rb
260
+ - spec/hydra_attribute/hydra_methods_spec.rb
261
+ - spec/hydra_attribute/hydra_set_methods_spec.rb
262
+ - spec/hydra_attribute/hydra_set_spec.rb
263
+ - spec/hydra_attribute/memoizable_spec.rb
227
264
  - spec/spec_helper.rb