daylight 0.9.0.rc1

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.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +113 -0
  3. data/app/controllers/daylight_documentation/documentation_controller.rb +27 -0
  4. data/app/helpers/daylight_documentation/documentation_helper.rb +57 -0
  5. data/app/views/daylight_documentation/documentation/_header.haml +4 -0
  6. data/app/views/daylight_documentation/documentation/index.haml +12 -0
  7. data/app/views/daylight_documentation/documentation/model.haml +114 -0
  8. data/app/views/layouts/documentation.haml +22 -0
  9. data/config/routes.rb +8 -0
  10. data/doc/actions.md +70 -0
  11. data/doc/benchmarks.md +17 -0
  12. data/doc/contribute.md +80 -0
  13. data/doc/develop.md +1205 -0
  14. data/doc/environment.md +109 -0
  15. data/doc/example.md +3 -0
  16. data/doc/framework.md +31 -0
  17. data/doc/install.md +128 -0
  18. data/doc/principles.md +42 -0
  19. data/doc/testing.md +107 -0
  20. data/doc/usage.md +970 -0
  21. data/lib/daylight/api.rb +293 -0
  22. data/lib/daylight/associations.rb +247 -0
  23. data/lib/daylight/client_reloader.rb +45 -0
  24. data/lib/daylight/collection.rb +161 -0
  25. data/lib/daylight/errors.rb +94 -0
  26. data/lib/daylight/inflections.rb +7 -0
  27. data/lib/daylight/mock.rb +282 -0
  28. data/lib/daylight/read_only.rb +88 -0
  29. data/lib/daylight/refinements.rb +63 -0
  30. data/lib/daylight/reflection_ext.rb +67 -0
  31. data/lib/daylight/resource_proxy.rb +226 -0
  32. data/lib/daylight/version.rb +10 -0
  33. data/lib/daylight.rb +27 -0
  34. data/rails/daylight/api_controller.rb +354 -0
  35. data/rails/daylight/documentation.rb +13 -0
  36. data/rails/daylight/helpers.rb +32 -0
  37. data/rails/daylight/params.rb +23 -0
  38. data/rails/daylight/refiners.rb +186 -0
  39. data/rails/daylight/server.rb +29 -0
  40. data/rails/daylight/tasks.rb +37 -0
  41. data/rails/extensions/array_ext.rb +9 -0
  42. data/rails/extensions/autosave_association_fix.rb +49 -0
  43. data/rails/extensions/has_one_serializer_ext.rb +111 -0
  44. data/rails/extensions/inflections.rb +6 -0
  45. data/rails/extensions/nested_attributes_ext.rb +94 -0
  46. data/rails/extensions/read_only_attributes.rb +35 -0
  47. data/rails/extensions/render_json_meta.rb +99 -0
  48. data/rails/extensions/route_options.rb +47 -0
  49. data/rails/extensions/versioned_url_for.rb +22 -0
  50. data/spec/config/dependencies.rb +2 -0
  51. data/spec/config/factory_girl.rb +4 -0
  52. data/spec/config/simplecov_rcov.rb +26 -0
  53. data/spec/config/test_api.rb +1 -0
  54. data/spec/controllers/documentation_controller_spec.rb +24 -0
  55. data/spec/dummy/README.rdoc +28 -0
  56. data/spec/dummy/Rakefile +6 -0
  57. data/spec/dummy/app/assets/images/.keep +0 -0
  58. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  59. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  60. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  61. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  62. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  63. data/spec/dummy/app/mailers/.keep +0 -0
  64. data/spec/dummy/app/models/.keep +0 -0
  65. data/spec/dummy/app/models/concerns/.keep +0 -0
  66. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  67. data/spec/dummy/bin/bundle +3 -0
  68. data/spec/dummy/bin/rails +4 -0
  69. data/spec/dummy/bin/rake +4 -0
  70. data/spec/dummy/config/application.rb +24 -0
  71. data/spec/dummy/config/boot.rb +5 -0
  72. data/spec/dummy/config/database.yml +25 -0
  73. data/spec/dummy/config/environment.rb +5 -0
  74. data/spec/dummy/config/environments/development.rb +29 -0
  75. data/spec/dummy/config/environments/production.rb +80 -0
  76. data/spec/dummy/config/environments/test.rb +36 -0
  77. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  78. data/spec/dummy/config/initializers/daylight.rb +1 -0
  79. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  80. data/spec/dummy/config/initializers/inflections.rb +16 -0
  81. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  82. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  83. data/spec/dummy/config/initializers/session_store.rb +3 -0
  84. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  85. data/spec/dummy/config/locales/en.yml +23 -0
  86. data/spec/dummy/config/routes.rb +59 -0
  87. data/spec/dummy/config.ru +4 -0
  88. data/spec/dummy/lib/assets/.keep +0 -0
  89. data/spec/dummy/log/.keep +0 -0
  90. data/spec/dummy/public/404.html +58 -0
  91. data/spec/dummy/public/422.html +58 -0
  92. data/spec/dummy/public/500.html +57 -0
  93. data/spec/dummy/public/favicon.ico +0 -0
  94. data/spec/helpers/documentation_helper_spec.rb +82 -0
  95. data/spec/lib/daylight/api_spec.rb +178 -0
  96. data/spec/lib/daylight/associations_spec.rb +325 -0
  97. data/spec/lib/daylight/collection_spec.rb +235 -0
  98. data/spec/lib/daylight/errors_spec.rb +111 -0
  99. data/spec/lib/daylight/mock_spec.rb +144 -0
  100. data/spec/lib/daylight/read_only_spec.rb +118 -0
  101. data/spec/lib/daylight/refinements_spec.rb +80 -0
  102. data/spec/lib/daylight/reflection_ext_spec.rb +50 -0
  103. data/spec/lib/daylight/resource_proxy_spec.rb +325 -0
  104. data/spec/rails/daylight/api_controller_spec.rb +421 -0
  105. data/spec/rails/daylight/helpers_spec.rb +41 -0
  106. data/spec/rails/daylight/params_spec.rb +45 -0
  107. data/spec/rails/daylight/refiners_spec.rb +178 -0
  108. data/spec/rails/extensions/array_ext_spec.rb +51 -0
  109. data/spec/rails/extensions/has_one_serializer_ext_spec.rb +135 -0
  110. data/spec/rails/extensions/nested_attributes_ext_spec.rb +177 -0
  111. data/spec/rails/extensions/render_json_meta_spec.rb +140 -0
  112. data/spec/rails/extensions/route_options_spec.rb +309 -0
  113. data/spec/rails/extensions/versioned_url_for_spec.rb +46 -0
  114. data/spec/spec_helper.rb +43 -0
  115. data/spec/support/migration_helper.rb +40 -0
  116. metadata +422 -0
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,59 @@
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+ # See how all your routes lay out with "rake routes".
4
+
5
+ # You can have the root of your site routed with "root"
6
+ # root 'welcome#index'
7
+
8
+ # Example of regular route:
9
+ # get 'products/:id' => 'catalog#view'
10
+
11
+ # Example of named route that can be invoked with purchase_url(id: product.id)
12
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
+
14
+ # Example resource route (maps HTTP verbs to controller actions automatically):
15
+ # resources :products
16
+
17
+ # Example resource route with options:
18
+ # resources :products do
19
+ # member do
20
+ # get 'short'
21
+ # post 'toggle'
22
+ # end
23
+ #
24
+ # collection do
25
+ # get 'sold'
26
+ # end
27
+ # end
28
+
29
+ # Example resource route with sub-resources:
30
+ # resources :products do
31
+ # resources :comments, :sales
32
+ # resource :seller
33
+ # end
34
+
35
+ # Example resource route with more complex sub-resources:
36
+ # resources :products do
37
+ # resources :comments
38
+ # resources :sales do
39
+ # get 'recent', on: :collection
40
+ # end
41
+ # end
42
+
43
+ # Example resource route with concerns:
44
+ # concern :toggleable do
45
+ # post 'toggle'
46
+ # end
47
+ # resources :posts, concerns: :toggleable
48
+ # resources :photos, concerns: :toggleable
49
+
50
+ # Example resource route within a namespace:
51
+ # namespace :admin do
52
+ # # Directs /admin/products/* to Admin::ProductsController
53
+ # # (app/controllers/admin/products_controller.rb)
54
+ # resources :products
55
+ # end
56
+
57
+ mount Daylight::Documentation => '/docs'
58
+
59
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
File without changes
File without changes
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,82 @@
1
+ require 'spec_helper'
2
+
3
+ describe DaylightDocumentation::DocumentationHelper do
4
+
5
+ class TestModel < ActiveRecord::Base
6
+ include Daylight::Associations
7
+
8
+ has_many :users
9
+
10
+ # override attribute names so we don't have to mock
11
+ # out the database table
12
+ def self.attribute_names
13
+ ['name']
14
+ end
15
+ end
16
+
17
+ before do
18
+ # create routes for our test model
19
+ Daylight::Documentation.routes.draw do
20
+ resources :test_models, associated: [:users]
21
+ end
22
+ end
23
+
24
+ after do
25
+ # make sure our existing routes are reloaded
26
+ Rails.application.reload_routes!
27
+ end
28
+
29
+ describe :model_verbs_and_routes do
30
+ it "yields the route verb, path, and defaults hash for the model" do
31
+ yielded = false
32
+ verbs = %w[GET POST PUT PATCH DELETE]
33
+ helper.model_verbs_and_routes TestModel do |verb, path, defaults|
34
+ verbs.should include(verb)
35
+ path.to_s.should =~ %r{/test_model}
36
+ defaults.should be_a(Hash)
37
+ yielded = true
38
+ end
39
+
40
+ yielded.should be_true
41
+ end
42
+ end
43
+
44
+ describe :model_filters do
45
+ it "returns list of the model's filters including attributes" do
46
+ helper.model_filters(TestModel).should include('name')
47
+ end
48
+
49
+ it "returns list of the model's filters including associations" do
50
+ helper.model_filters(TestModel).should include('users')
51
+ end
52
+ end
53
+
54
+ describe :action_definition do
55
+ it "returns a definition for an action" do
56
+ helper.action_definition({action:'index'}, TestModel).should ==
57
+ "Retrieves a list of test models"
58
+ end
59
+
60
+ it "handles associated" do
61
+ helper.action_definition({action:'associated', associated:'foo_bar'}, TestModel).should ==
62
+ "Returns test model's foo bars"
63
+ end
64
+
65
+ it "handles remoted" do
66
+ helper.action_definition({action:'remoted', remoted:'baz'}, TestModel).should ==
67
+ "Calls test model's remote method baz"
68
+ end
69
+ end
70
+
71
+ describe :client_namespace do
72
+ it "returns the client namespace" do
73
+ helper.client_namespace.should == 'test_api'
74
+ end
75
+ end
76
+
77
+ describe :api_version do
78
+ it "returns the api version" do
79
+ helper.api_version.should == 'v1'
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,178 @@
1
+ require 'spec_helper'
2
+
3
+ class TestDescendant < Daylight::API
4
+ self.password = nil
5
+
6
+ has_one :child, class_name: 'TestDescendant'
7
+ end
8
+
9
+ class TestAPIDescendantJSON < Daylight::API
10
+ def self.format
11
+ ActiveResource::Formats[:json]
12
+ end
13
+ end
14
+
15
+ class TestAPIDescendantXML < Daylight::API
16
+ def self.format
17
+ ActiveResource::Formats[:xml]
18
+ end
19
+ end
20
+
21
+ describe Daylight::API do
22
+ def parse_xml(xml)
23
+ data = Hash.from_xml(xml)
24
+
25
+ if data.is_a?(Hash) && data.keys.size == 1
26
+ data.values.first
27
+ else
28
+ data
29
+ end
30
+ end
31
+
32
+ before do
33
+ @original_namespace = Daylight::API.namespace
34
+ @original_password = Daylight::API.password
35
+ @original_endpoint = Daylight::API.endpoint
36
+ @original_version = Daylight::API.version.downcase
37
+ end
38
+
39
+ after do
40
+ silence_warnings do
41
+ Daylight::API.setup!({
42
+ namespace: @original_namespace,
43
+ endpoint: @original_endpoint,
44
+ version: @original_version,
45
+ password: @original_password
46
+ })
47
+ end
48
+ end
49
+
50
+ it 'raises an error if setup with bad version' do
51
+ expect { Daylight::API.setup! version: 'v0' }.to raise_error(StandardError, /Unsupported version v0/)
52
+ end
53
+
54
+ it 'sets up site and prefix' do
55
+ silence_warnings do
56
+ Daylight::API.setup! endpoint: 'http://api.Daylight.test/', version: 'v1'
57
+ end
58
+
59
+ Daylight::API.site.to_s.should == 'http://api.Daylight.test/'
60
+ Daylight::API.prefix.should == '/v1/'
61
+ end
62
+
63
+ it 'sets request_root_in_json to true by default' do
64
+ Daylight::API.request_root_in_json.should == true
65
+ TestAPIDescendantJSON.request_root_in_json.should == true
66
+ TestAPIDescendantXML.request_root_in_json.should == true
67
+ end
68
+
69
+ it 'returns request_root_in_json? based on format.extension' do
70
+ TestAPIDescendantJSON.request_root_in_json?.should == true
71
+ TestAPIDescendantXML.request_root_in_json?.should == false
72
+ end
73
+
74
+ it 'encodes setting only the root of the outer-most object' do
75
+ inner = TestAPIDescendantJSON.new(name: 'inner')
76
+ outer = TestAPIDescendantJSON.new(name: 'outer', tests: [inner])
77
+
78
+ outer.encode.should == '{"test_api_descendant_json":{"name":"outer","tests":[{"name":"inner"}]}}'
79
+ end
80
+
81
+ # works also when querying a belongs_to foreign key
82
+ it 'returns nil when looking up a single record with a nil lookup' do
83
+ TestDescendant.find(nil).should be_nil
84
+ end
85
+
86
+ describe "nested attributes" do
87
+ before do
88
+ data = {
89
+ test_descendant: {
90
+ id: 1,
91
+ child_attributes: {
92
+ id: 2,
93
+ toy: {id: 5, name: 'slinky'}
94
+ },
95
+ other_attributes: {
96
+ id: 4
97
+ },
98
+ other_hash: {
99
+ id: 3
100
+ }
101
+ }
102
+ }
103
+
104
+ stub_request(:get, %r{#{TestDescendant.site}}).to_return(body: data.to_json)
105
+ end
106
+
107
+ it "does not objectify a known reflection's attributes" do
108
+ test = TestDescendant.find(1)
109
+ test.child_attributes['id'].should == 2
110
+ end
111
+
112
+ it "objectifies hashes within a known reflection's attributes" do
113
+ test = TestDescendant.find(1)
114
+ test.child_attributes['toy'].should be_kind_of(ActiveResource::Base)
115
+ test.child_attributes['toy'].attributes.should == {'id' => 5, 'name' => 'slinky'}
116
+ end
117
+
118
+ it "still objectifies other attributes" do
119
+ test = TestDescendant.find(1)
120
+ test.other_attributes.should be_kind_of(ActiveResource::Base)
121
+ end
122
+
123
+ it "still objectifies other hashes" do
124
+ test = TestDescendant.find(1)
125
+ test.other_hash.should be_kind_of(ActiveResource::Base)
126
+ end
127
+ end
128
+
129
+ describe "nested_resources" do
130
+ before do
131
+ data = {
132
+ test_descendant: { name: "foo", immutable: "readme"},
133
+ meta: { test_descendant: { read_only: ["immutable"], nested_resources: ["test_resource"] } }
134
+ }
135
+
136
+ stub_request(:get, %r{#{TestDescendant.site}}).to_return(body: data.to_json)
137
+ end
138
+
139
+ it "is defined" do
140
+ test = TestDescendant.find(1)
141
+
142
+ test.nested_resources.should == ["test_resource"]
143
+ end
144
+ end
145
+
146
+ describe 'metadata' do
147
+ before do
148
+ data = {
149
+ test_descendant: { name: "foo", immutable: "readme"},
150
+ meta: { test_descendant: { read_only: ["immutable"], nested_resources: ["test_resource"] } }
151
+ }
152
+
153
+ stub_request(:any, %r{#{TestDescendant.site}}).to_return(body: data.to_json)
154
+ end
155
+
156
+ it "is extracted from the response" do
157
+ test = TestDescendant.find(1)
158
+
159
+ test.metadata.should be_present
160
+ test.metadata['read_only'].should == ['immutable']
161
+ end
162
+
163
+ it "is extracted from the response on an update" do
164
+ test = TestDescendant.find(1)
165
+ test.metadata.should be_present
166
+ test.metadata.clear
167
+ test.metadata.should_not be_present
168
+
169
+ test.save
170
+ test.metadata.should be_present
171
+ end
172
+
173
+ it "is extracted from the response on a create" do
174
+ test = TestDescendant.create(name: 'foo')
175
+ test.metadata.should be_present
176
+ end
177
+ end
178
+ end