setting_accessors 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 912a9cc992d18c425f566cb38e4d13f8d40e98a2
4
- data.tar.gz: 6a97b4452c34bcf03ba558a80dcffe0fc8e374a2
3
+ metadata.gz: 0b94565258ae7fce43922281d6b76f20d300c623
4
+ data.tar.gz: 20a552250f28acc7de4709ad9aa0bdd2d9686ab4
5
5
  SHA512:
6
- metadata.gz: cff208b475cadc713e358a4314929cb904160a24b2d76eee9c2e2004011684949612cfeda01bf985f02fc2d86aff5206c1125ecd7c3a66143c213c8e08cc0d80
7
- data.tar.gz: 21651ebb8af2fc3d395240402c88fb937e37b6bd0402046cc322c165eea1f73600cfb84e6b1074076e16cd08309ef10f34d8b5127f840596c8559ee1cfbb1aa3
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
 
@@ -1,3 +1,3 @@
1
1
  module SettingAccessors
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -0,0 +1,2 @@
1
+ class Post < ActiveRecord::Base
2
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.belongs_to :user
5
+ t.string :title
6
+ t.string :text
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -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: 20150102115329) do
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"
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
@@ -1,3 +1,5 @@
1
+ require_relative '../../../test_helper'
2
+
1
3
  class UserTest < ActiveSupport::TestCase
2
4
  context 'JSON serialization' do
3
5
  setup do
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.6
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-22 00:00:00.000000000 Z
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