praxis 2.0.pre.6 → 2.0.pre.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +1 -3
- data/CHANGELOG.md +25 -0
- data/TODO.md +1 -4
- data/bin/praxis +67 -12
- data/lib/praxis.rb +10 -3
- data/lib/praxis/action_definition.rb +15 -13
- data/lib/praxis/action_definition/headers_dsl_compiler.rb +0 -7
- data/lib/praxis/api_general_info.rb +1 -1
- data/lib/praxis/application.rb +6 -2
- data/lib/praxis/blueprint.rb +357 -0
- data/lib/praxis/bootloader.rb +9 -3
- data/lib/praxis/bootloader_stages/environment.rb +16 -13
- data/lib/praxis/collection.rb +1 -11
- data/lib/praxis/config_hash.rb +44 -0
- data/lib/praxis/docs/{openapi → open_api}/info_object.rb +18 -10
- data/lib/praxis/docs/{openapi → open_api}/media_type_object.rb +0 -0
- data/lib/praxis/docs/{openapi → open_api}/operation_object.rb +0 -0
- data/lib/praxis/docs/{openapi → open_api}/parameter_object.rb +2 -2
- data/lib/praxis/docs/{openapi → open_api}/paths_object.rb +12 -15
- data/lib/praxis/docs/{openapi → open_api}/request_body_object.rb +0 -0
- data/lib/praxis/docs/{openapi → open_api}/response_object.rb +0 -0
- data/lib/praxis/docs/{openapi → open_api}/responses_object.rb +0 -0
- data/lib/praxis/docs/{openapi → open_api}/schema_object.rb +0 -0
- data/lib/praxis/docs/{openapi → open_api}/server_object.rb +0 -0
- data/lib/praxis/docs/{openapi → open_api}/tag_object.rb +0 -0
- data/lib/praxis/docs/open_api_generator.rb +91 -6
- data/lib/praxis/endpoint_definition.rb +273 -0
- data/lib/praxis/extensions/attribute_filtering/active_record_filter_query_builder.rb +57 -8
- data/lib/praxis/extensions/attribute_filtering/filtering_params.rb +3 -16
- data/lib/praxis/extensions/attribute_filtering/sequel_filter_query_builder.rb +20 -8
- data/lib/praxis/extensions/field_expansion.rb +3 -36
- data/lib/praxis/extensions/pagination.rb +5 -32
- data/lib/praxis/extensions/pagination/ordering_params.rb +5 -1
- data/lib/praxis/extensions/pagination/pagination_params.rb +10 -4
- data/lib/praxis/field_expander.rb +90 -0
- data/lib/praxis/finalizable.rb +34 -0
- data/lib/praxis/mapper/active_model_compat.rb +4 -0
- data/lib/praxis/mapper/resource.rb +18 -2
- data/lib/praxis/mapper/selector_generator.rb +2 -1
- data/lib/praxis/mapper/sequel_compat.rb +7 -0
- data/lib/praxis/media_type.rb +3 -68
- data/lib/praxis/plugin_concern.rb +1 -1
- data/lib/praxis/plugins/mapper_plugin.rb +24 -15
- data/lib/praxis/plugins/pagination_plugin.rb +34 -4
- data/lib/praxis/renderer.rb +88 -0
- data/lib/praxis/request.rb +1 -1
- data/lib/praxis/resource_definition.rb +2 -311
- data/lib/praxis/response_definition.rb +2 -10
- data/lib/praxis/response_template.rb +3 -3
- data/lib/praxis/router.rb +2 -2
- data/lib/praxis/routing_config.rb +1 -1
- data/lib/praxis/tasks/api_docs.rb +17 -64
- data/lib/praxis/tasks/routes.rb +2 -2
- data/lib/praxis/types/media_type_common.rb +1 -11
- data/lib/praxis/version.rb +1 -1
- data/praxis.gemspec +0 -1
- data/spec/functional_spec.rb +5 -9
- data/spec/praxis/action_definition_spec.rb +12 -20
- data/spec/praxis/blueprint_spec.rb +373 -0
- data/spec/praxis/bootloader_spec.rb +10 -2
- data/spec/praxis/collection_spec.rb +0 -13
- data/spec/praxis/config_hash_spec.rb +64 -0
- data/spec/praxis/{resource_definition_spec.rb → endpoint_definition_spec.rb} +37 -64
- data/spec/praxis/extensions/attribute_filtering/active_record_filter_query_builder_spec.rb +19 -8
- data/spec/praxis/extensions/attribute_filtering/filtering_params_spec.rb +106 -0
- data/spec/praxis/extensions/field_expansion_spec.rb +5 -24
- data/spec/praxis/extensions/field_selection/active_record_query_selector_spec.rb +1 -1
- data/spec/praxis/extensions/field_selection/sequel_query_selector_spec.rb +1 -1
- data/spec/praxis/extensions/support/spec_resources_active_model.rb +1 -1
- data/spec/praxis/field_expander_spec.rb +149 -0
- data/spec/praxis/mapper/selector_generator_spec.rb +1 -1
- data/spec/praxis/media_type_identifier_spec.rb +5 -4
- data/spec/praxis/media_type_spec.rb +4 -93
- data/spec/praxis/renderer_spec.rb +188 -0
- data/spec/praxis/response_definition_spec.rb +0 -31
- data/spec/praxis/response_spec.rb +1 -1
- data/spec/praxis/router_spec.rb +8 -8
- data/spec/praxis/routing_config_spec.rb +3 -3
- data/spec/spec_app/app/controllers/instances.rb +13 -7
- data/spec/spec_app/design/media_types/instance.rb +1 -19
- data/spec/spec_app/design/media_types/volume.rb +1 -1
- data/spec/spec_app/design/media_types/volume_snapshot.rb +2 -14
- data/spec/spec_app/design/resources/instances.rb +5 -8
- data/spec/spec_app/design/resources/volume_snapshots.rb +1 -1
- data/spec/spec_app/design/resources/volumes.rb +1 -1
- data/spec/support/spec_authorization_plugin.rb +1 -1
- data/spec/support/spec_blueprints.rb +72 -0
- data/spec/support/{spec_resource_definitions.rb → spec_endpoint_definitions.rb} +2 -2
- data/spec/support/spec_media_types.rb +6 -26
- data/tasks/thor/app.rb +8 -34
- data/tasks/thor/example.rb +51 -285
- data/tasks/thor/model.rb +40 -0
- data/tasks/thor/scaffold.rb +117 -0
- data/tasks/thor/templates/generator/empty_app/.gitignore +0 -1
- data/tasks/thor/templates/generator/empty_app/Gemfile +7 -23
- data/tasks/thor/templates/generator/empty_app/README.md +1 -1
- data/tasks/thor/templates/generator/empty_app/Rakefile +4 -13
- data/tasks/thor/templates/generator/empty_app/{design/response_templates → app/v1/resources}/.empty_directory +0 -0
- data/tasks/thor/templates/generator/empty_app/{design/response_templates → app/v1/resources}/.gitkeep +0 -0
- data/tasks/thor/templates/generator/empty_app/config/environment.rb +26 -17
- data/tasks/thor/templates/generator/empty_app/{design/v1/resources → config/initializers}/.empty_directory +0 -0
- data/tasks/thor/templates/generator/empty_app/{design/v1/resources → config/initializers}/.gitkeep +0 -0
- data/tasks/thor/templates/generator/empty_app/design/v1/endpoints/.empty_directory +0 -0
- data/tasks/thor/templates/generator/empty_app/design/v1/endpoints/.gitkeep +0 -0
- data/tasks/thor/templates/generator/empty_app/docs/.empty_directory +0 -0
- data/tasks/thor/templates/generator/empty_app/docs/.gitkeep +0 -0
- data/tasks/thor/templates/generator/empty_app/spec/spec_helper.rb +14 -9
- data/tasks/thor/templates/generator/example_app/.gitignore +1 -0
- data/tasks/thor/templates/generator/example_app/Gemfile +19 -0
- data/tasks/thor/templates/generator/example_app/Rakefile +61 -0
- data/tasks/thor/templates/generator/example_app/app/models/user.rb +6 -0
- data/tasks/thor/templates/generator/example_app/app/v1/concerns/controller_base.rb +24 -0
- data/tasks/thor/templates/generator/example_app/app/v1/controllers/users.rb +17 -0
- data/tasks/thor/templates/generator/example_app/app/v1/resources/base.rb +11 -0
- data/tasks/thor/templates/generator/example_app/app/v1/resources/user.rb +25 -0
- data/tasks/thor/templates/generator/example_app/config.ru +30 -0
- data/tasks/thor/templates/generator/example_app/config/environment.rb +41 -0
- data/tasks/thor/templates/generator/example_app/db/migrate/20201010101010_create_users_table.rb +12 -0
- data/tasks/thor/templates/generator/example_app/db/seeds.rb +6 -0
- data/tasks/thor/templates/generator/example_app/design/api.rb +18 -0
- data/tasks/thor/templates/generator/example_app/design/v1/endpoints/users.rb +37 -0
- data/tasks/thor/templates/generator/example_app/design/v1/media_types/user.rb +21 -0
- data/tasks/thor/templates/generator/example_app/spec/helpers/database_helper.rb +20 -0
- data/tasks/thor/templates/generator/example_app/spec/spec_helper.rb +42 -0
- data/tasks/thor/templates/generator/example_app/spec/v1/controllers/users_spec.rb +37 -0
- data/tasks/thor/templates/generator/scaffold/design/endpoints/collection.rb +98 -0
- data/tasks/thor/templates/generator/scaffold/design/media_types/item.rb +18 -0
- data/tasks/thor/templates/generator/scaffold/implementation/controllers/collection.rb +77 -0
- data/tasks/thor/templates/generator/scaffold/implementation/resources/base.rb +11 -0
- data/tasks/thor/templates/generator/scaffold/implementation/resources/item.rb +45 -0
- data/tasks/thor/templates/generator/scaffold/models/active_record.rb +6 -0
- data/tasks/thor/templates/generator/scaffold/models/sequel.rb +6 -0
- metadata +62 -136
- data/lib/api_browser/.bowerrc +0 -3
- data/lib/api_browser/.editorconfig +0 -21
- data/lib/api_browser/Gruntfile.js +0 -581
- data/lib/api_browser/app/index.html +0 -59
- data/lib/api_browser/app/js/app.js +0 -48
- data/lib/api_browser/app/js/controllers/action.js +0 -47
- data/lib/api_browser/app/js/controllers/controller.js +0 -10
- data/lib/api_browser/app/js/controllers/menu.js +0 -93
- data/lib/api_browser/app/js/controllers/trait.js +0 -10
- data/lib/api_browser/app/js/controllers/type.js +0 -24
- data/lib/api_browser/app/js/directives/attribute_description.js +0 -56
- data/lib/api_browser/app/js/directives/attribute_table.js +0 -28
- data/lib/api_browser/app/js/directives/conditional_requirements.js +0 -13
- data/lib/api_browser/app/js/directives/fixed_if_fits.js +0 -38
- data/lib/api_browser/app/js/directives/highlight.js +0 -14
- data/lib/api_browser/app/js/directives/menu_item.js +0 -59
- data/lib/api_browser/app/js/directives/no_container.js +0 -8
- data/lib/api_browser/app/js/directives/readable_list.js +0 -87
- data/lib/api_browser/app/js/directives/request_examples.js +0 -31
- data/lib/api_browser/app/js/directives/type_placeholder.js +0 -30
- data/lib/api_browser/app/js/directives/url.js +0 -15
- data/lib/api_browser/app/js/factories/Configuration.js +0 -12
- data/lib/api_browser/app/js/factories/Documentation.js +0 -61
- data/lib/api_browser/app/js/factories/Example.js +0 -51
- data/lib/api_browser/app/js/factories/PageInfo.js +0 -9
- data/lib/api_browser/app/js/factories/normalize_attributes.js +0 -20
- data/lib/api_browser/app/js/factories/prepare_template.js +0 -15
- data/lib/api_browser/app/js/factories/template_for.js +0 -128
- data/lib/api_browser/app/js/filters/attribute_name.js +0 -10
- data/lib/api_browser/app/js/filters/friendly_json.js +0 -5
- data/lib/api_browser/app/js/filters/has_requirement.js +0 -14
- data/lib/api_browser/app/js/filters/header_info.js +0 -9
- data/lib/api_browser/app/js/filters/is_empty.js +0 -8
- data/lib/api_browser/app/js/filters/markdown.js +0 -6
- data/lib/api_browser/app/js/filters/resource_name.js +0 -5
- data/lib/api_browser/app/js/filters/tag_requirement.js +0 -13
- data/lib/api_browser/app/sass/modules/_body.scss +0 -40
- data/lib/api_browser/app/sass/modules/_cloke.scss +0 -8
- data/lib/api_browser/app/sass/modules/_header.scss +0 -10
- data/lib/api_browser/app/sass/modules/_nav.scss +0 -7
- data/lib/api_browser/app/sass/modules/_sidebar.scss +0 -134
- data/lib/api_browser/app/sass/modules/_switch.scss +0 -55
- data/lib/api_browser/app/sass/modules/_table.scss +0 -13
- data/lib/api_browser/app/sass/praxis.scss +0 -70
- data/lib/api_browser/app/sass/variables/_bootstrap-variables.scss +0 -774
- data/lib/api_browser/app/views/action.html +0 -97
- data/lib/api_browser/app/views/builtin/field-selector.html +0 -24
- data/lib/api_browser/app/views/controller.html +0 -55
- data/lib/api_browser/app/views/directives/attribute_description.html +0 -2
- data/lib/api_browser/app/views/directives/attribute_description/default.html +0 -2
- data/lib/api_browser/app/views/directives/attribute_description/example.html +0 -13
- data/lib/api_browser/app/views/directives/attribute_description/headers.html +0 -8
- data/lib/api_browser/app/views/directives/attribute_description/member_options.html +0 -4
- data/lib/api_browser/app/views/directives/attribute_description/values.html +0 -14
- data/lib/api_browser/app/views/directives/attribute_table.html +0 -17
- data/lib/api_browser/app/views/directives/menu_item.html +0 -8
- data/lib/api_browser/app/views/directives/url.html +0 -3
- data/lib/api_browser/app/views/examples/general.html +0 -26
- data/lib/api_browser/app/views/home.html +0 -5
- data/lib/api_browser/app/views/layout.html +0 -8
- data/lib/api_browser/app/views/menu.html +0 -42
- data/lib/api_browser/app/views/navbar.html +0 -9
- data/lib/api_browser/app/views/trait.html +0 -13
- data/lib/api_browser/app/views/type.html +0 -6
- data/lib/api_browser/app/views/type/details.html +0 -33
- data/lib/api_browser/app/views/types/embedded/array.html +0 -2
- data/lib/api_browser/app/views/types/embedded/default.html +0 -12
- data/lib/api_browser/app/views/types/embedded/field-selector.html +0 -13
- data/lib/api_browser/app/views/types/embedded/links.html +0 -11
- data/lib/api_browser/app/views/types/embedded/requirements.html +0 -6
- data/lib/api_browser/app/views/types/embedded/single_req.html +0 -9
- data/lib/api_browser/app/views/types/embedded/struct.html +0 -14
- data/lib/api_browser/app/views/types/label/link.html +0 -1
- data/lib/api_browser/app/views/types/label/primitive.html +0 -1
- data/lib/api_browser/app/views/types/label/primitive_collection.html +0 -1
- data/lib/api_browser/app/views/types/label/type.html +0 -1
- data/lib/api_browser/app/views/types/label/type_collection.html +0 -1
- data/lib/api_browser/app/views/types/main/array.html +0 -22
- data/lib/api_browser/app/views/types/main/default.html +0 -23
- data/lib/api_browser/app/views/types/main/hash.html +0 -23
- data/lib/api_browser/app/views/types/standalone/array.html +0 -3
- data/lib/api_browser/app/views/types/standalone/default.html +0 -18
- data/lib/api_browser/app/views/types/standalone/struct.html +0 -2
- data/lib/api_browser/bower_template.json +0 -41
- data/lib/api_browser/package-lock.json +0 -7110
- data/lib/api_browser/package.json +0 -43
- data/lib/praxis/docs/generator.rb +0 -243
- data/lib/praxis/docs/link_builder.rb +0 -30
- data/lib/praxis/links.rb +0 -135
- data/lib/praxis/types/multipart.rb +0 -109
- data/spec/api_browser/directives/type_placeholder_spec.js +0 -134
- data/spec/api_browser/factories/configuration_spec.js +0 -32
- data/spec/api_browser/factories/documentation_spec.js +0 -100
- data/spec/api_browser/factories/normalize_attributes_spec.js +0 -92
- data/spec/api_browser/factories/template_for_spec.js +0 -67
- data/spec/api_browser/filters/attribute_name_spec.js +0 -23
- data/spec/praxis/types/multipart_spec.rb +0 -112
- data/tasks/thor/templates/generator/empty_app/.rspec +0 -1
- data/tasks/thor/templates/generator/empty_app/Guardfile +0 -3
- data/tasks/thor/templates/generator/empty_app/config/rainbows.rb +0 -57
- data/tasks/thor/templates/generator/empty_app/docs/app.js +0 -1
- data/tasks/thor/templates/generator/empty_app/docs/styles.scss +0 -3
@@ -1,67 +0,0 @@
|
|
1
|
-
describe('templateFor service', function() {
|
2
|
-
var $scope, templateFor, $http, customResolver;
|
3
|
-
|
4
|
-
beforeEach(angular.mock.module('PraxisDocBrowser'));
|
5
|
-
|
6
|
-
beforeEach(function() {
|
7
|
-
customResolver = function() {};
|
8
|
-
angular.module('PraxisDocBrowser').config(function(templateForProvider) {
|
9
|
-
templateForProvider.register(function($type, $family) {
|
10
|
-
return customResolver($type, $family);
|
11
|
-
});
|
12
|
-
});
|
13
|
-
});
|
14
|
-
|
15
|
-
beforeEach(inject(function($rootScope, $injector) {
|
16
|
-
$scope = $rootScope.$new();
|
17
|
-
$http = $injector.get('$http');
|
18
|
-
templateFor = $injector.get('templateFor');
|
19
|
-
}));
|
20
|
-
|
21
|
-
describe('default templates', function() {
|
22
|
-
beforeEach(inject(function($templateCache) {
|
23
|
-
$templateCache.put('views/types/standalone/struct.html', '<div>standalone -> Struct</div>');
|
24
|
-
$templateCache.put('views/types/standalone/default.html', '<div>standalone -> Default</div>');
|
25
|
-
$templateCache.put('views/types/embedded/links.html', '<div>embedded -> Links</div>');
|
26
|
-
$templateCache.put('views/types/embedded/struct.html', '<div>embedded -> Struct</div>');
|
27
|
-
$templateCache.put('views/types/embedded/default.html', '<div>embedded -> Default</div>');
|
28
|
-
}));
|
29
|
-
_.each(['standalone', 'embedded'], function(templateType) {
|
30
|
-
_.each([
|
31
|
-
{name: 'Struct', family: 'hash'},
|
32
|
-
{name: 'Links', family: 'hash'},
|
33
|
-
{name: 'Default', family: 'Numeric'}
|
34
|
-
], function(type) {
|
35
|
-
it('resolve ' + templateType + ' ' + type.name, function() {
|
36
|
-
var result;
|
37
|
-
templateFor(type, templateType).then(function(template) {
|
38
|
-
result = template($scope);
|
39
|
-
});
|
40
|
-
$scope.$apply();
|
41
|
-
var name = templateType === 'standalone' && type.name === 'Links' ? 'Struct' : type.name;
|
42
|
-
expect(result.text().split(' -> ')).toEqual([templateType, name]);
|
43
|
-
});
|
44
|
-
});
|
45
|
-
});
|
46
|
-
});
|
47
|
-
|
48
|
-
describe('custom templates', function() {
|
49
|
-
var result;
|
50
|
-
beforeEach(inject(function($templateCache) {
|
51
|
-
$templateCache.put('views/mytype.html', '<div>custom</div>');
|
52
|
-
customResolver = jasmine.createSpy().and.returnValue('views/mytype.html');
|
53
|
-
templateFor({name: 'Custom', family: 'CustomFamily'}, true).then(function(template) {
|
54
|
-
result = template($scope);
|
55
|
-
});
|
56
|
-
$scope.$apply();
|
57
|
-
}));
|
58
|
-
|
59
|
-
it('calls the custom resolver', function() {
|
60
|
-
expect(customResolver).toHaveBeenCalledWith('Custom', 'CustomFamily');
|
61
|
-
});
|
62
|
-
|
63
|
-
it('returns the custom template', function() {
|
64
|
-
expect(result.text()).toEqual('custom');
|
65
|
-
});
|
66
|
-
});
|
67
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
describe('attributeName filter', function() {
|
2
|
-
var filter;
|
3
|
-
beforeEach(angular.mock.module('PraxisDocBrowser'));
|
4
|
-
|
5
|
-
beforeEach(inject(function(attributeNameFilter, $sce) {
|
6
|
-
filter = function(input) {
|
7
|
-
return $sce.getTrusted('html', attributeNameFilter(input));
|
8
|
-
};
|
9
|
-
}));
|
10
|
-
|
11
|
-
it('only modifies input with one or more dots', function() {
|
12
|
-
expect(function(str) {
|
13
|
-
var dotsCount = str.split('.').length - 1;
|
14
|
-
if (dotsCount === 0) {
|
15
|
-
return str === filter(str);
|
16
|
-
}
|
17
|
-
}).forAll(qc.string);
|
18
|
-
});
|
19
|
-
|
20
|
-
it('adds a tag to the prefix', function() {
|
21
|
-
expect(filter('ns.test')).toEqual('<span class="attribute-prefix">ns.</span>test');
|
22
|
-
});
|
23
|
-
});
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Praxis::Multipart do
|
4
|
-
let(:type) { Praxis::Multipart }
|
5
|
-
|
6
|
-
let(:form) do
|
7
|
-
form_data = MIME::Multipart::FormData.new
|
8
|
-
entity = MIME::Text.new('1')
|
9
|
-
form_data.add entity,'some_name'
|
10
|
-
form_data
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:content_type) { form.headers.get('Content-Type') }
|
14
|
-
let(:body) { form.body.to_s }
|
15
|
-
|
16
|
-
subject(:multipart) { type.load(body, content_type: content_type) }
|
17
|
-
|
18
|
-
context 'with no block' do
|
19
|
-
its(:parts) { should have(1).item }
|
20
|
-
its(['some_name']) { should eq('1') }
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'with value type' do
|
24
|
-
let(:type) do
|
25
|
-
silence_warnings do
|
26
|
-
Praxis::Multipart.of(value: Integer)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
its(['some_name']) { should eq(1) }
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
context 'with a block' do
|
34
|
-
|
35
|
-
let(:block) do
|
36
|
-
proc do
|
37
|
-
key 'some_name', Integer
|
38
|
-
key 'some_date', DateTime
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
let(:date) { DateTime.parse("2014-07-15") }
|
43
|
-
|
44
|
-
before do
|
45
|
-
entity = MIME::Text.new(date)
|
46
|
-
form.add entity,'some_date'
|
47
|
-
end
|
48
|
-
|
49
|
-
let(:type) { silence_warnings { Praxis::Multipart.construct(block) } }
|
50
|
-
|
51
|
-
its(['some_name']) { should eq(1) }
|
52
|
-
its(['some_date']) { should eq(date) }
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
context 'with a preamble' do
|
58
|
-
let(:preamble) { "some preamble"}
|
59
|
-
let(:body) { preamble + "\r\n" + form.body.to_s }
|
60
|
-
|
61
|
-
it 'preserves the value' do
|
62
|
-
expect(multipart.preamble).to eq(preamble)
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
context '.example' do
|
68
|
-
let(:type) do
|
69
|
-
silence_warnings do
|
70
|
-
Praxis::Multipart.of(value: Instance)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
subject(:example) { type.example('example') }
|
75
|
-
|
76
|
-
it 'generates an interesting example' do
|
77
|
-
expect(example.keys.all? { |k| k.kind_of? String }).to be(true)
|
78
|
-
expect(example.values.all? { |k| k.kind_of? Instance }).to be(true)
|
79
|
-
expect(example.parts.keys).to eq(example.keys.collect(&:to_s))
|
80
|
-
|
81
|
-
|
82
|
-
instance = Instance.load(example.parts.first.last.body)
|
83
|
-
expect(instance.validate).to be_empty
|
84
|
-
|
85
|
-
expect(example.headers['Content-Type']).to match(/multipart\/form-data; boundary=/)
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
context '.load' do
|
91
|
-
it 'returns nil when loading nil' do
|
92
|
-
expect(type.load(nil)).to be nil
|
93
|
-
end
|
94
|
-
it 'returns the same value when loading an instance of a Multipart class' do
|
95
|
-
instance = Praxis::Multipart.example
|
96
|
-
expect(type.load(instance)).to be instance
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'complains when the value is not a String (besides a Multipart instance or nil)' do
|
100
|
-
expect{
|
101
|
-
type.load( {a: "hash"} )
|
102
|
-
}.to raise_error(Attributor::CoercionError)
|
103
|
-
end
|
104
|
-
|
105
|
-
pending 'complete the load tests'
|
106
|
-
end
|
107
|
-
|
108
|
-
context '#describe' do
|
109
|
-
subject(:described) { type.describe }
|
110
|
-
its([:family]){ should eq('multipart')}
|
111
|
-
end
|
112
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
|
2
|
-
# documentation.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
5
|
-
|
6
|
-
if [ 'integration', 'staging', 'production', 'meta' ].include?(ENV['RACK_ENV'])
|
7
|
-
PID_FILE = '/var/run/rainbows/rainbows.pid'
|
8
|
-
LOG_FILE = '/var/log/rails/rainbows.log'
|
9
|
-
else
|
10
|
-
PID_FILE = File.join(APP_PATH, 'rainbows.pid')
|
11
|
-
LOG_FILE = APP_PATH + "/log/rainbows.log"
|
12
|
-
end
|
13
|
-
|
14
|
-
nr_processes = (ENV['RACK_ENV'] == 'development' ? 1 : '@@RAINBOWS_WORKER_PROCESSES@@____'.to_i)
|
15
|
-
if nr_processes == 0
|
16
|
-
raise "Invalid configuration: number of rainbows workers is 0 (was RAINBOWS_WORKER_PROCESSES substituted?)"
|
17
|
-
end
|
18
|
-
|
19
|
-
Rainbows! do
|
20
|
-
worker_connections 400
|
21
|
-
keepalive_timeout 5 # zero disables keepalives entirely
|
22
|
-
client_max_body_size 5*1024*1024 # 5 megabytes
|
23
|
-
end
|
24
|
-
|
25
|
-
worker_processes nr_processes
|
26
|
-
|
27
|
-
# All production STs include an application owner field (which we assume to also be the same group)
|
28
|
-
# Thus use that user and group accordingly to run the application.
|
29
|
-
if [ 'integration', 'staging', 'production', 'meta' ].include?(ENV['RAILS_ENV'])
|
30
|
-
user('@@APPLICATION_OWNER@@','@@APPLICATION_OWNER@@')
|
31
|
-
end
|
32
|
-
|
33
|
-
# Help ensure your application will always spawn in the symlinked
|
34
|
-
# "current" directory that Capistrano sets up.
|
35
|
-
working_directory APP_PATH
|
36
|
-
|
37
|
-
stderr_path LOG_FILE
|
38
|
-
stdout_path LOG_FILE
|
39
|
-
|
40
|
-
# listen on both a Unix domain socket and a TCP port,
|
41
|
-
# we use a shorter backlog for quicker failover when busy
|
42
|
-
# listen 8080, :tcp_nopush => true
|
43
|
-
listen 8080
|
44
|
-
|
45
|
-
# PID file location
|
46
|
-
pid PID_FILE
|
47
|
-
|
48
|
-
# combine REE with "preload_app true" for memory savings
|
49
|
-
# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
|
50
|
-
preload_app true
|
51
|
-
|
52
|
-
GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true
|
53
|
-
|
54
|
-
after_fork do |server, worker|
|
55
|
-
# re-establish db connections here
|
56
|
-
end
|
57
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
angular.module('DocBrowser', ['PraxisDocBrowser']);
|