setting_accessors 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/setting_accessors/internal.rb +1 -0
- data/lib/setting_accessors/version.rb +1 -1
- data/test/dummy/app/models/post.rb +2 -0
- data/test/dummy/db/migrate/20150723114600_create_posts.rb +11 -0
- data/test/dummy/db/schema.rb +9 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/test/fixtures/posts.yml +11 -0
- data/test/dummy/test/models/post_test.rb +19 -0
- data/test/dummy/test/models/user_test.rb +2 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b94565258ae7fce43922281d6b76f20d300c623
|
4
|
+
data.tar.gz: 20a552250f28acc7de4709ad9aa0bdd2d9686ab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94f79c3276a678e92ea28b2b557b98ab3d926cb04bf14033359cd7a91ad7038db756fd452d542ba53597b883deba0ad545484a396fd98813a2392de06dd3d776
|
7
|
+
data.tar.gz: eaa0a4c1a96dd730525dd753e6347fb28d06d31bca26dcfebbfb6619dc60af5b77c83dcae2f85d7a22b0542425c9b6cff075df79f28db46bb440ddd40a12b133
|
@@ -119,6 +119,7 @@ module SettingAccessors
|
|
119
119
|
# @return [Array<String>] all setting accessor names defined in the given +class+
|
120
120
|
#
|
121
121
|
def self.setting_accessor_names(klass)
|
122
|
+
@@setting_accessor_names ||= {}
|
122
123
|
self.lookup_nested_hash(@@setting_accessor_names, klass.to_s) || []
|
123
124
|
end
|
124
125
|
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,15 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20150723114600) do
|
15
|
+
|
16
|
+
create_table "posts", force: :cascade do |t|
|
17
|
+
t.integer "user_id"
|
18
|
+
t.string "title"
|
19
|
+
t.string "text"
|
20
|
+
t.datetime "created_at", null: false
|
21
|
+
t.datetime "updated_at", null: false
|
22
|
+
end
|
15
23
|
|
16
24
|
create_table "settings", force: :cascade do |t|
|
17
25
|
t.integer "assignable_id"
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
|
3
|
+
# This model initially had no columns defined. If you add columns to the
|
4
|
+
# model remove the '{}' from the fixture names and add the columns immediately
|
5
|
+
# below each fixture, per the syntax in the comments below
|
6
|
+
#
|
7
|
+
one: {}
|
8
|
+
# column: value
|
9
|
+
#
|
10
|
+
two: {}
|
11
|
+
# column: value
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative '../../../test_helper'
|
2
|
+
|
3
|
+
class PostTest < ActiveSupport::TestCase
|
4
|
+
context 'JSON serialization' do
|
5
|
+
setup do
|
6
|
+
@post = Post.new(:title => 'a post', :text => 'a content')
|
7
|
+
end
|
8
|
+
|
9
|
+
should 'work without having any setting_accessors defined' do
|
10
|
+
assert @post.as_json
|
11
|
+
end
|
12
|
+
|
13
|
+
should 'contain all original public attributes' do
|
14
|
+
[:title, :text, :id, :created_at, :updated_at].each do |attr|
|
15
|
+
assert_includes @post.as_json.keys, attr.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: setting_accessors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Exner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- test/dummy/app/mailers/.keep
|
152
152
|
- test/dummy/app/models/.keep
|
153
153
|
- test/dummy/app/models/concerns/.keep
|
154
|
+
- test/dummy/app/models/post.rb
|
154
155
|
- test/dummy/app/models/setting.rb
|
155
156
|
- test/dummy/app/models/user.rb
|
156
157
|
- test/dummy/app/views/layouts/application.html.erb
|
@@ -179,6 +180,7 @@ files:
|
|
179
180
|
- test/dummy/config/settings.yml
|
180
181
|
- test/dummy/db/migrate/20150102112106_create_users.rb
|
181
182
|
- test/dummy/db/migrate/20150102115329_create_settings.rb
|
183
|
+
- test/dummy/db/migrate/20150723114600_create_posts.rb
|
182
184
|
- test/dummy/db/schema.rb
|
183
185
|
- test/dummy/db/test.sqlite3
|
184
186
|
- test/dummy/lib/assets/.keep
|
@@ -187,6 +189,8 @@ files:
|
|
187
189
|
- test/dummy/public/422.html
|
188
190
|
- test/dummy/public/500.html
|
189
191
|
- test/dummy/public/favicon.ico
|
192
|
+
- test/dummy/test/fixtures/posts.yml
|
193
|
+
- test/dummy/test/models/post_test.rb
|
190
194
|
- test/dummy/test/models/setting_test.rb
|
191
195
|
- test/dummy/test/models/user_test.rb
|
192
196
|
- test/generators/install_generator_test.rb
|
@@ -228,6 +232,7 @@ test_files:
|
|
228
232
|
- test/dummy/app/mailers/.keep
|
229
233
|
- test/dummy/app/models/.keep
|
230
234
|
- test/dummy/app/models/concerns/.keep
|
235
|
+
- test/dummy/app/models/post.rb
|
231
236
|
- test/dummy/app/models/setting.rb
|
232
237
|
- test/dummy/app/models/user.rb
|
233
238
|
- test/dummy/app/views/layouts/application.html.erb
|
@@ -256,6 +261,7 @@ test_files:
|
|
256
261
|
- test/dummy/config/settings.yml
|
257
262
|
- test/dummy/db/migrate/20150102112106_create_users.rb
|
258
263
|
- test/dummy/db/migrate/20150102115329_create_settings.rb
|
264
|
+
- test/dummy/db/migrate/20150723114600_create_posts.rb
|
259
265
|
- test/dummy/db/schema.rb
|
260
266
|
- test/dummy/db/test.sqlite3
|
261
267
|
- test/dummy/lib/assets/.keep
|
@@ -264,6 +270,8 @@ test_files:
|
|
264
270
|
- test/dummy/public/422.html
|
265
271
|
- test/dummy/public/500.html
|
266
272
|
- test/dummy/public/favicon.ico
|
273
|
+
- test/dummy/test/fixtures/posts.yml
|
274
|
+
- test/dummy/test/models/post_test.rb
|
267
275
|
- test/dummy/test/models/setting_test.rb
|
268
276
|
- test/dummy/test/models/user_test.rb
|
269
277
|
- test/generators/install_generator_test.rb
|