dm_preferences 1.0 → 1.5

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm_preferences
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
@@ -9,50 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-01 00:00:00.000000000 Z
12
+ date: 2017-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4.2'
21
- type: :development
21
+ type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '4.2'
28
- - !ruby/object:Gem::Dependency
29
- name: sqlite3
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ~>
33
- - !ruby/object:Gem::Version
34
- version: '0'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ~>
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- - !ruby/object:Gem::Dependency
43
- name: rspec-rails
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ~>
47
- - !ruby/object:Gem::Version
48
- version: '3.0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
55
- version: '3.0'
56
28
  description: Adds support for easily creating custom preferences for ActiveRecord
57
29
  models
58
30
  email: github@digitalmoksha.com
@@ -63,8 +35,8 @@ extra_rdoc_files:
63
35
  - CHANGELOG.md
64
36
  - LICENSE
65
37
  files:
66
- - .gitignore
67
- - .travis.yml
38
+ - ".gitignore"
39
+ - ".travis.yml"
68
40
  - CHANGELOG.md
69
41
  - Gemfile
70
42
  - LICENSE
@@ -117,10 +89,13 @@ files:
117
89
  - spec/dummy/db/test.sqlite3
118
90
  - spec/dummy/log/development.log
119
91
  - spec/dummy/log/test.log
92
+ - spec/factories/car_factory.rb
93
+ - spec/factories/employee_factory.rb
94
+ - spec/factories/preference_factory.rb
95
+ - spec/factories/users_factory.rb
120
96
  - spec/functional/preferences_spec.rb
121
97
  - spec/spec_helper.rb
122
98
  - spec/support/assert_queries.rb
123
- - spec/support/factory.rb
124
99
  - spec/unit/preference_definition_spec.rb
125
100
  - spec/unit/preference_spec.rb
126
101
  homepage: https://github.com/digitalmoksha/preferences
@@ -129,27 +104,27 @@ licenses:
129
104
  metadata: {}
130
105
  post_install_message:
131
106
  rdoc_options:
132
- - --line-numbers
133
- - --inline-source
134
- - --title
107
+ - "--line-numbers"
108
+ - "--inline-source"
109
+ - "--title"
135
110
  - preferences
136
- - --main
111
+ - "--main"
137
112
  - README.rdoc
138
113
  require_paths:
139
114
  - lib
140
115
  required_ruby_version: !ruby/object:Gem::Requirement
141
116
  requirements:
142
- - - ! '>='
117
+ - - ">="
143
118
  - !ruby/object:Gem::Version
144
119
  version: '0'
145
120
  required_rubygems_version: !ruby/object:Gem::Requirement
146
121
  requirements:
147
- - - ! '>='
122
+ - - ">="
148
123
  - !ruby/object:Gem::Version
149
124
  version: '0'
150
125
  requirements: []
151
126
  rubyforge_project:
152
- rubygems_version: 2.4.2
127
+ rubygems_version: 2.6.8
153
128
  signing_key:
154
129
  specification_version: 4
155
130
  summary: Custom preferences for ActiveRecord models
@@ -190,9 +165,12 @@ test_files:
190
165
  - spec/dummy/log/development.log
191
166
  - spec/dummy/log/test.log
192
167
  - spec/dummy/Rakefile
168
+ - spec/factories/car_factory.rb
169
+ - spec/factories/employee_factory.rb
170
+ - spec/factories/preference_factory.rb
171
+ - spec/factories/users_factory.rb
193
172
  - spec/functional/preferences_spec.rb
194
173
  - spec/spec_helper.rb
195
174
  - spec/support/assert_queries.rb
196
- - spec/support/factory.rb
197
175
  - spec/unit/preference_definition_spec.rb
198
176
  - spec/unit/preference_spec.rb
@@ -1,65 +0,0 @@
1
- module Factory
2
- # Build actions for the model
3
- def self.build(model, &block)
4
- name = model.to_s.underscore
5
-
6
- define_method("#{name}_attributes", block)
7
- define_method("valid_#{name}_attributes") {|*args| valid_attributes_for(model, *args)}
8
- define_method("new_#{name}") {|*args| new_record(model, *args)}
9
- define_method("create_#{name}") {|*args| create_record(model, *args)}
10
- end
11
-
12
- # Get valid attributes for the model
13
- def valid_attributes_for(model, attributes = {})
14
- name = model.to_s.underscore
15
- send("#{name}_attributes", attributes)
16
- attributes.stringify_keys!
17
- attributes
18
- end
19
-
20
- # Build an unsaved record
21
- def new_record(model, *args)
22
- attributes = valid_attributes_for(model, *args)
23
- record = model.new(attributes)
24
- attributes.each {|attr, value| record.send("#{attr}=", value)}
25
- record
26
- end
27
-
28
- # Build and save/reload a record
29
- def create_record(model, *args)
30
- record = new_record(model, *args)
31
- record.save!
32
- record.reload
33
- record
34
- end
35
-
36
- build Car do |attributes|
37
- attributes.reverse_merge!(
38
- :name => 'Porsche'
39
- )
40
- end
41
-
42
- build Employee do |attributes|
43
- attributes.reverse_merge!(
44
- :name => 'John Smith'
45
- )
46
- end
47
-
48
- build Manager do |attributes|
49
- valid_employee_attributes(attributes)
50
- end
51
-
52
- build Preference do |attributes|
53
- attributes[:owner] = create_user unless attributes.include?(:owner)
54
- attributes.reverse_merge!(
55
- :name => 'notifications',
56
- :value => false
57
- )
58
- end
59
-
60
- build User do |attributes|
61
- attributes.reverse_merge!(
62
- :login => 'admin'
63
- )
64
- end
65
- end