praxis 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/.ruby-version +1 -1
- data/.travis.yml +2 -1
- data/CHANGELOG.md +41 -0
- data/CONTRIBUTING.md +3 -0
- data/lib/api_browser/Gruntfile.js +20 -4
- data/lib/api_browser/app/bower_components/angular-mocks/.bower.json +6 -6
- data/lib/api_browser/app/bower_components/angular-mocks/README.md +11 -5
- data/lib/api_browser/app/bower_components/angular-mocks/angular-mocks.js +475 -216
- data/lib/api_browser/app/bower_components/angular-mocks/bower.json +2 -2
- data/lib/api_browser/app/bower_components/angular-mocks/ngAnimateMock.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/ngMock.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/ngMockE2E.js +2 -0
- data/lib/api_browser/app/bower_components/angular-mocks/package.json +1 -1
- data/lib/api_browser/app/bower_components/angular-sanitize/.bower.json +8 -8
- data/lib/api_browser/app/bower_components/angular-sanitize/README.md +19 -5
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.js +186 -127
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.min.js +12 -10
- data/lib/api_browser/app/bower_components/angular-sanitize/angular-sanitize.min.js.map +3 -3
- data/lib/api_browser/app/bower_components/angular-sanitize/bower.json +3 -2
- data/lib/api_browser/app/bower_components/angular-sanitize/index.js +2 -0
- data/lib/api_browser/app/bower_components/angular-sanitize/package.json +26 -0
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/.bower.json +15 -8
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/bower.json +11 -3
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-csp.css +6 -0
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.js +1177 -453
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap-tpls.min.js +4 -4
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap.js +1066 -404
- data/lib/api_browser/app/bower_components/angular-ui-bootstrap-bower/ui-bootstrap.min.js +3 -3
- data/lib/api_browser/app/bower_components/angular-ui-router/.bower.json +5 -6
- data/lib/api_browser/app/bower_components/angular-ui-router/CHANGELOG.md +208 -3
- data/lib/api_browser/app/bower_components/angular-ui-router/CONTRIBUTING.md +65 -0
- data/lib/api_browser/app/bower_components/angular-ui-router/LICENSE +1 -1
- data/lib/api_browser/app/bower_components/angular-ui-router/README.md +36 -71
- data/lib/api_browser/app/bower_components/angular-ui-router/api/angular-ui-router.d.ts +126 -0
- data/lib/api_browser/app/bower_components/angular-ui-router/bower.json +1 -1
- data/lib/api_browser/app/bower_components/angular-ui-router/release/angular-ui-router.js +1902 -755
- data/lib/api_browser/app/bower_components/angular-ui-router/release/angular-ui-router.min.js +2 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/common.js +69 -23
- data/lib/api_browser/app/bower_components/angular-ui-router/src/resolve.js +15 -5
- data/lib/api_browser/app/bower_components/angular-ui-router/src/state.js +556 -295
- data/lib/api_browser/app/bower_components/angular-ui-router/src/stateDirectives.js +101 -42
- data/lib/api_browser/app/bower_components/angular-ui-router/src/stateFilters.js +6 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/templateFactory.js +2 -2
- data/lib/api_browser/app/bower_components/angular-ui-router/src/urlMatcherFactory.js +822 -97
- data/lib/api_browser/app/bower_components/angular-ui-router/src/urlRouter.js +274 -120
- data/lib/api_browser/app/bower_components/angular-ui-router/src/viewDirective.js +33 -20
- data/lib/api_browser/app/bower_components/angular-ui-router/src/viewScroll.js +1 -1
- data/lib/api_browser/app/bower_components/angular/.bower.json +5 -5
- data/lib/api_browser/app/bower_components/angular/README.md +2 -5
- data/lib/api_browser/app/bower_components/angular/angular-csp.css +5 -8
- data/lib/api_browser/app/bower_components/angular/angular.js +12975 -6996
- data/lib/api_browser/app/bower_components/angular/angular.min.js +285 -213
- data/lib/api_browser/app/bower_components/angular/angular.min.js.gzip +0 -0
- data/lib/api_browser/app/bower_components/angular/angular.min.js.map +3 -3
- data/lib/api_browser/app/bower_components/angular/bower.json +1 -1
- data/lib/api_browser/app/bower_components/angular/index.js +2 -0
- data/lib/api_browser/app/bower_components/angular/package.json +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/.bower.json +31 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/CHANGELOG.md +108 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/CONTRIBUTING.md +55 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/README.md +147 -206
- data/lib/api_browser/app/bower_components/bootstrap-sass/bower.json +19 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.eot +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.svg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.ttf +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{dist/fonts → vendor/assets/fonts/bootstrap}/glyphicons-halflings-regular.woff +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/vendor/assets/javascripts/bootstrap.js +12 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/affix.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/alert.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/button.js +11 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/carousel.js +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/collapse.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/dropdown.js +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/modal.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/popover.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/scrollspy.js +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/tab.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/tooltip.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{js → vendor/assets/javascripts/bootstrap}/transition.js +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/vendor/assets/stylesheets/bootstrap.scss +1 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_alerts.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_badges.scss +6 -6
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_breadcrumbs.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_button-groups.scss +7 -33
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_buttons.scss +2 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_carousel.scss +1 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_close.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_code.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_component-animations.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_dropdowns.scss +3 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_forms.scss +11 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_glyphicons.scss +5 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_grid.scss +12 -26
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_input-groups.scss +1 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_jumbotron.scss +8 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_labels.scss +6 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_list-group.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_media.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_mixins.scss +38 -51
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_modals.scss +2 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_navbar.scss +41 -53
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_navs.scss +0 -20
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_normalize.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_pager.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_pagination.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_panels.scss +11 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_popovers.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_print.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_progress-bars.scss +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_responsive-utilities.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_scaffolding.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_tables.scss +5 -18
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_theme.scss +2 -2
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_thumbnails.scss +9 -3
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_tooltip.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_type.scss +54 -52
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_utilities.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_variables.scss +20 -11
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/_wells.scss +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/{lib → vendor/assets/stylesheets/bootstrap}/bootstrap.scss +0 -0
- data/lib/api_browser/app/bower_components/lodash/.bower.json +9 -13
- data/lib/api_browser/app/bower_components/lodash/LICENSE.txt +3 -3
- data/lib/api_browser/app/bower_components/lodash/bower.json +4 -7
- data/lib/api_browser/app/bower_components/lodash/lodash.js +12235 -0
- data/lib/api_browser/app/bower_components/lodash/lodash.min.js +98 -0
- data/lib/api_browser/app/index.html +0 -1
- data/lib/api_browser/app/js/app.js +2 -5
- data/lib/api_browser/app/js/controllers/action.js +21 -37
- data/lib/api_browser/app/js/controllers/controller.js +23 -1
- data/lib/api_browser/app/js/controllers/menu.js +46 -14
- data/lib/api_browser/app/js/controllers/type.js +2 -9
- data/lib/api_browser/app/js/directives/attribute_description.js +15 -5
- data/lib/api_browser/app/js/directives/attribute_table.js +6 -6
- data/lib/api_browser/app/js/directives/fixed_if_fits.js +20 -0
- data/lib/api_browser/app/js/directives/no_container.js +6 -6
- data/lib/api_browser/app/js/directives/type_placeholder.js +21 -0
- data/lib/api_browser/app/js/factories/Configuration.js +13 -0
- data/lib/api_browser/app/js/factories/Documentation.js +0 -3
- data/lib/api_browser/app/js/factories/normalize_attributes.js +19 -0
- data/lib/api_browser/app/js/factories/template_for.js +113 -0
- data/lib/api_browser/app/sass/modules/_body.scss +26 -4
- data/lib/api_browser/app/sass/modules/_sidebar.scss +68 -1
- data/lib/api_browser/app/sass/praxis.scss +1 -5
- data/lib/api_browser/app/sass/variables/_bootstrap-variables.scss +13 -4
- data/lib/api_browser/app/views/action.html +13 -17
- data/lib/api_browser/app/views/controller.html +32 -4
- data/lib/api_browser/app/views/directives/attribute_description.html +1 -1
- data/lib/api_browser/app/views/directives/attribute_description/{_default.html → default.html} +0 -0
- data/lib/api_browser/app/views/directives/attribute_description/example.html +13 -0
- data/lib/api_browser/app/views/directives/attribute_description/headers.html +8 -0
- data/lib/api_browser/app/views/directives/attribute_description/member_options.html +4 -0
- data/lib/api_browser/app/views/directives/attribute_description/values.html +14 -0
- data/lib/api_browser/app/views/directives/attribute_table.html +2 -2
- data/lib/api_browser/app/views/home.html +1 -3
- data/lib/api_browser/app/views/layout.html +3 -36
- data/lib/api_browser/app/views/menu.html +45 -0
- data/lib/api_browser/app/views/navbar.html +1 -1
- data/lib/api_browser/app/views/type.html +2 -2
- data/lib/api_browser/app/views/type/{_details.html → details.html} +6 -6
- data/lib/api_browser/app/views/types/embedded/default.html +10 -0
- data/lib/api_browser/app/views/types/embedded/links.html +11 -0
- data/lib/api_browser/app/views/types/embedded/struct.html +2 -0
- data/lib/api_browser/app/views/types/label/link.html +1 -0
- data/lib/api_browser/app/views/types/label/primitive.html +1 -0
- data/lib/api_browser/app/views/types/label/primitive_collection.html +1 -0
- data/lib/api_browser/app/views/types/label/type.html +1 -0
- data/lib/api_browser/app/views/types/label/type_collection.html +1 -0
- data/lib/api_browser/app/views/{directives/request_body/_default.html → types/standalone/default.html} +1 -1
- data/lib/api_browser/app/views/types/standalone/struct.html +1 -0
- data/lib/api_browser/bower.json +9 -9
- data/lib/api_browser/package.json +1 -1
- data/lib/praxis.rb +10 -4
- data/lib/praxis/action_definition.rb +16 -4
- data/lib/praxis/action_definition/headers_dsl_compiler.rb +5 -2
- data/lib/praxis/api_definition.rb +3 -1
- data/lib/praxis/api_general_info.rb +49 -5
- data/lib/praxis/application.rb +12 -4
- data/lib/praxis/bootloader.rb +1 -0
- data/lib/praxis/bootloader_stages/environment.rb +2 -0
- data/lib/praxis/bootloader_stages/routing.rb +1 -1
- data/lib/praxis/bootloader_stages/subgroup_loader.rb +1 -0
- data/lib/praxis/exceptions/validation.rb +7 -0
- data/lib/praxis/handlers/plain.rb +16 -0
- data/lib/praxis/handlers/xml.rb +4 -4
- data/lib/praxis/links.rb +13 -3
- data/lib/praxis/media_type_identifier.rb +3 -0
- data/lib/praxis/multipart/parser.rb +41 -48
- data/lib/praxis/multipart/part.rb +196 -3
- data/lib/praxis/request.rb +14 -11
- data/lib/praxis/request_stages/request_stage.rb +4 -0
- data/lib/praxis/request_stages/response.rb +10 -9
- data/lib/praxis/request_stages/validate.rb +1 -7
- data/lib/praxis/request_stages/validate_params_and_headers.rb +30 -5
- data/lib/praxis/request_stages/validate_payload.rb +14 -5
- data/lib/praxis/resource_definition.rb +117 -15
- data/lib/praxis/response.rb +6 -5
- data/lib/praxis/response_definition.rb +51 -5
- data/lib/praxis/responses/http.rb +5 -0
- data/lib/praxis/responses/multipart_ok.rb +51 -0
- data/lib/praxis/responses/validation_error.rb +7 -7
- data/lib/praxis/restful_doc_generator.rb +9 -4
- data/lib/praxis/route.rb +3 -2
- data/lib/praxis/router.rb +26 -16
- data/lib/praxis/router/rack.rb +51 -0
- data/lib/praxis/router/simple.rb +146 -0
- data/lib/praxis/routing_config.rb +2 -2
- data/lib/praxis/trait.rb +1 -1
- data/lib/praxis/types/fuzzy_hash.rb +49 -0
- data/lib/praxis/types/media_type_common.rb +1 -1
- data/lib/praxis/types/multipart.rb +47 -12
- data/lib/praxis/types/multipart_array.rb +320 -0
- data/lib/praxis/types/multipart_array/part_definition.rb +52 -0
- data/lib/praxis/validation_handler.rb +10 -0
- data/lib/praxis/version.rb +2 -2
- data/praxis.gemspec +3 -3
- data/spec/api_browser/directives/type_placeholder_spec.js +134 -0
- data/spec/api_browser/factories/normalize_attributes_spec.js +97 -0
- data/spec/api_browser/factories/template_for_spec.js +67 -0
- data/spec/functional_spec.rb +111 -45
- data/spec/praxis/action_definition_spec.rb +31 -7
- data/spec/praxis/api_definition_spec.rb +2 -2
- data/spec/praxis/api_general_info_spec.rb +25 -0
- data/spec/praxis/application_spec.rb +24 -11
- data/spec/praxis/handlers/xml_spec.rb +55 -33
- data/spec/praxis/links_spec.rb +18 -1
- data/spec/praxis/media_type_collection_spec.rb +1 -1
- data/spec/praxis/media_type_spec.rb +2 -2
- data/spec/praxis/multipart/parser_spec.rb +21 -13
- data/spec/praxis/plugins/praxis_mapper_plugin_spec.rb +1 -1
- data/spec/praxis/request_spec.rb +52 -24
- data/spec/praxis/{request_stages_action_spec.rb → request_stages/action_spec.rb} +1 -1
- data/spec/praxis/{request_stage_spec.rb → request_stages/request_stage_spec.rb} +0 -0
- data/spec/praxis/{request_stages_validate_spec.rb → request_stages/validate_spec.rb} +1 -1
- data/spec/praxis/resource_definition_spec.rb +30 -4
- data/spec/praxis/response_definition_spec.rb +60 -19
- data/spec/praxis/response_spec.rb +2 -2
- data/spec/praxis/responses/validation_error_spec.rb +33 -16
- data/spec/praxis/route_spec.rb +4 -2
- data/spec/praxis/router_spec.rb +28 -12
- data/spec/praxis/routing_config_spec.rb +11 -5
- data/spec/praxis/types/collection_spec.rb +1 -1
- data/spec/praxis/types/fuzzy_hash_spec.rb +20 -0
- data/spec/praxis/types/multipart_array/part_definition_spec.rb +5 -0
- data/spec/praxis/types/multipart_array_spec.rb +334 -0
- data/spec/praxis/types/multipart_spec.rb +14 -5
- data/spec/spec_app/app/controllers/instances.rb +20 -10
- data/spec/spec_app/app/controllers/volumes.rb +8 -4
- data/spec/spec_app/app/responses/bulk_response.rb +0 -6
- data/spec/spec_app/config/environment.rb +13 -0
- data/spec/spec_app/design/api.rb +7 -10
- data/spec/spec_app/design/media_types/instance.rb +3 -1
- data/spec/spec_app/design/resources/instances.rb +50 -41
- data/spec/spec_app/design/resources/volume_snapshots.rb +39 -0
- data/spec/spec_app/design/resources/volumes.rb +11 -6
- data/spec/spec_helper.rb +3 -1
- metadata +125 -218
- data/lib/api_browser/app/bower_components/angular-ui-router/src/compat.js +0 -146
- data/lib/api_browser/app/bower_components/bootstrap-sass/CNAME +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/DOCS-LICENSE +0 -319
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gemfile +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gemfile.lock +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/Gruntfile.js +0 -244
- data/lib/api_browser/app/bower_components/bootstrap-sass/LICENSE +0 -176
- data/lib/api_browser/app/bower_components/bootstrap-sass/LICENSE-MIT +0 -21
- data/lib/api_browser/app/bower_components/bootstrap-sass/Rakefile +0 -44
- data/lib/api_browser/app/bower_components/bootstrap-sass/_config.yml +0 -25
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/ads.html +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/footer.html +0 -34
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/header.html +0 -42
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-about.html +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-components.html +0 -137
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-css.html +0 -99
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-customize.html +0 -40
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-getting-started.html +0 -44
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-javascript.html +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/nav-main.html +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/old-bs-docs.html +0 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/_includes/social-buttons.html +0 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/_layouts/default.html +0 -79
- data/lib/api_browser/app/bower_components/bootstrap-sass/_layouts/home.html +0 -47
- data/lib/api_browser/app/bower_components/bootstrap-sass/about.html +0 -93
- data/lib/api_browser/app/bower_components/bootstrap-sass/browserstack.json +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/components.html +0 -3689
- data/lib/api_browser/app/bower_components/bootstrap-sass/composer.json +0 -28
- data/lib/api_browser/app/bower_components/bootstrap-sass/css.html +0 -2674
- data/lib/api_browser/app/bower_components/bootstrap-sass/customize.html +0 -1715
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap-theme.css +0 -427
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap-theme.min.css +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap.css +0 -6350
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/css/bootstrap.min.css +0 -1
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/js/bootstrap.js +0 -2002
- data/lib/api_browser/app/bower_components/bootstrap-sass/dist/js/bootstrap.min.js +0 -9
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/css/docs.css +0 -1195
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/css/pygments-manni.css +0 -66
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/ico/favicon.png +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/application.js +0 -103
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/customizer.js +0 -332
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/filesaver.js +0 -169
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/holder.js +0 -404
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/ie8-responsive-file-warning.js +0 -12
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/jszip.js +0 -1467
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/less.js +0 -9
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/raw-files.js +0 -3
- data/lib/api_browser/app/bower_components/bootstrap-sass/docs-assets/js/uglify.js +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/carousel/carousel.css +0 -148
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/carousel/index.html +0 -206
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/grid/grid.css +0 -28
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/grid/index.html +0 -148
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron-narrow/index.html +0 -82
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron-narrow/jumbotron-narrow.css +0 -79
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron/index.html +0 -99
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/jumbotron/jumbotron.css +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/justified-nav/index.html +0 -83
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/justified-nav/justified-nav.css +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-fixed-top/index.html +0 -91
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-fixed-top/navbar-fixed-top.css +0 -4
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-static-top/index.html +0 -92
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar-static-top/navbar-static-top.css +0 -7
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar/index.html +0 -88
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/navbar/navbar.css +0 -8
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/non-responsive/index.html +0 -101
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/non-responsive/non-responsive.css +0 -116
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/index.html +0 -130
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/offcanvas.css +0 -50
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/offcanvas/offcanvas.js +0 -5
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/carousel.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/grid.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/jumbotron-narrow.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/jumbotron.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/justified-nav.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar-fixed.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar-static.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/navbar.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/non-responsive.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/offcanvas.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sign-in.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/starter-template.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sticky-footer-navbar.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/sticky-footer.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/screenshots/theme.jpg +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/signin/index.html +0 -50
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/signin/signin.css +0 -40
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/starter-template/index.html +0 -68
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/starter-template/starter-template.css +0 -7
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer-navbar/index.html +0 -91
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer-navbar/sticky-footer-navbar.css +0 -45
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer/index.html +0 -55
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/sticky-footer/sticky-footer.css +0 -38
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/theme/index.html +0 -384
- data/lib/api_browser/app/bower_components/bootstrap-sass/examples/theme/theme.css +0 -14
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.svg +0 -229
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/api_browser/app/bower_components/bootstrap-sass/getting-started.html +0 -1021
- data/lib/api_browser/app/bower_components/bootstrap-sass/index.html +0 -16
- data/lib/api_browser/app/bower_components/bootstrap-sass/javascript.html +0 -1983
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/index.html +0 -52
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/affix.js +0 -25
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/alert.js +0 -62
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/button.js +0 -116
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/carousel.js +0 -87
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/collapse.js +0 -164
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/dropdown.js +0 -219
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/modal.js +0 -196
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/phantom.js +0 -69
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/popover.js +0 -133
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/scrollspy.js +0 -37
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/tab.js +0 -86
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/tooltip.js +0 -437
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/unit/transition.js +0 -13
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/jquery.js +0 -6
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/qunit.css +0 -232
- data/lib/api_browser/app/bower_components/bootstrap-sass/js/tests/vendor/qunit.js +0 -1510
- data/lib/api_browser/app/bower_components/bootstrap-sass/package.json +0 -40
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.compat.js +0 -7157
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.compat.min.js +0 -61
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.js +0 -6785
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.min.js +0 -56
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.underscore.js +0 -4979
- data/lib/api_browser/app/bower_components/lodash/dist/lodash.underscore.min.js +0 -39
- data/lib/api_browser/app/js/directives/attribute_table_row.js +0 -17
- data/lib/api_browser/app/js/directives/request_body.js +0 -25
- data/lib/api_browser/app/js/directives/request_headers.js +0 -17
- data/lib/api_browser/app/js/directives/request_parameters.js +0 -17
- data/lib/api_browser/app/js/directives/type_label.js +0 -52
- data/lib/api_browser/app/js/factories/PayloadTemplates.js +0 -10
- data/lib/api_browser/app/js/factories/TemplateProvider.js +0 -45
- data/lib/api_browser/app/js/factories/TypeTemplates.js +0 -11
- 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_table_row/_default.html +0 -10
- data/lib/api_browser/app/views/directives/attribute_table_row/_links.html +0 -11
- data/lib/api_browser/app/views/directives/attribute_table_row/_struct.html +0 -2
- data/lib/api_browser/app/views/directives/request_body/_struct.html +0 -1
- data/lib/api_browser/app/views/resource/_actions.html +0 -27
@@ -11,7 +11,7 @@ describe Praxis::ActionDefinition do
|
|
11
11
|
|
12
12
|
media_type 'application/json'
|
13
13
|
version '1.0'
|
14
|
-
prefix '/
|
14
|
+
prefix '/foobars/hello_world'
|
15
15
|
action_defaults do
|
16
16
|
payload { attribute :inherited, String }
|
17
17
|
headers { header "Inherited", String }
|
@@ -90,7 +90,7 @@ describe Praxis::ActionDefinition do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
its('params.attributes.keys') { should eq [:inherited, :app_name, :name, :one]}
|
93
|
-
its('routes.first.path.to_s') { should eq '/api/hello_world/test_trait/:app_name/:one' }
|
93
|
+
its('routes.first.path.to_s') { should eq '/api/foobars/hello_world/test_trait/:app_name/:one' }
|
94
94
|
its(:traits) { should eq [:test] }
|
95
95
|
|
96
96
|
it 'is reflected in the describe output' do
|
@@ -141,8 +141,32 @@ describe Praxis::ActionDefinition do
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
|
145
|
-
|
144
|
+
context '#routing' do
|
145
|
+
context 'with a parent specified' do
|
146
|
+
let(:resource) { ApiResources::VolumeSnapshots }
|
147
|
+
subject(:action) { resource.actions[:show] }
|
148
|
+
|
149
|
+
let(:parent_param) { ApiResources::Volumes.actions[:show].params.attributes[:id] }
|
150
|
+
|
151
|
+
it 'has the right path' do
|
152
|
+
expect(action.primary_route.path.to_s).to eq '/api/clouds/:cloud_id/volumes/:volume_id/snapshots/:id'
|
153
|
+
end
|
154
|
+
|
155
|
+
its('params.attributes'){ should have_key(:cloud_id) }
|
156
|
+
|
157
|
+
context 'with pre-existing parent param' do
|
158
|
+
let(:action) { resource.actions[:index] }
|
159
|
+
subject(:param) { action.params.attributes[:volume_id] }
|
160
|
+
its(:options) { should_not eq parent_param.options }
|
161
|
+
end
|
162
|
+
|
163
|
+
context 'with auto-generated param' do
|
164
|
+
subject(:param) { action.params.attributes[:volume_id] }
|
165
|
+
it { should_not be nil }
|
166
|
+
its(:options) { should eq parent_param.options }
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
146
170
|
end
|
147
171
|
|
148
172
|
context '#description' do
|
@@ -171,7 +195,7 @@ describe Praxis::ActionDefinition do
|
|
171
195
|
|
172
196
|
it 'works' do
|
173
197
|
expansion = action.primary_route.path.expand(cloud_id:232, id: 2)
|
174
|
-
expect(expansion).to eq "/clouds/232/instances/2"
|
198
|
+
expect(expansion).to eq "/api/clouds/232/instances/2"
|
175
199
|
end
|
176
200
|
|
177
201
|
context '#primary_route' do
|
@@ -228,7 +252,7 @@ describe Praxis::ActionDefinition do
|
|
228
252
|
allow(Praxis::ApiDefinition).to receive(:instance).and_return(non_singleton_api)
|
229
253
|
end
|
230
254
|
|
231
|
-
its('routes.first.path.to_s') { should eq '/apps/:app_name/
|
255
|
+
its('routes.first.path.to_s') { should eq '/apps/:app_name/foobars/hello_world/:one' }
|
232
256
|
its('params.attributes.keys') { should eq [:inherited, :app_name, :one]}
|
233
257
|
|
234
258
|
context 'where the action overrides a base_param' do
|
@@ -241,7 +265,7 @@ describe Praxis::ActionDefinition do
|
|
241
265
|
'FooBar'
|
242
266
|
end
|
243
267
|
version '1.0'
|
244
|
-
prefix '/
|
268
|
+
prefix '/foobars/hello_world'
|
245
269
|
action_defaults do
|
246
270
|
payload { attribute :inherited, String }
|
247
271
|
headers { header "Inherited", String }
|
@@ -134,7 +134,7 @@ describe Praxis::ApiDefinition do
|
|
134
134
|
its([:title]) { should eq 'A simple App to do some simple integration testing' }
|
135
135
|
its([:description]) { should eq 'This example API should really be replaced by a set of more full-fledged example apps in the future' }
|
136
136
|
end
|
137
|
-
|
137
|
+
|
138
138
|
it 'outputs data for 1.0 info' do
|
139
139
|
expect(output.keys).to include("1.0")
|
140
140
|
expect(output["1.0"]).to include(:info)
|
@@ -147,7 +147,7 @@ describe Praxis::ApiDefinition do
|
|
147
147
|
expect(info[:name]).to eq("Spec App")
|
148
148
|
expect(info[:title]).to eq("A simple App to do some simple integration testing")
|
149
149
|
expect(info[:description]).to eq("A simple 1.0 App")
|
150
|
-
expect(info[:base_path]).to eq("/")
|
150
|
+
expect(info[:base_path]).to eq("/api")
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -4,11 +4,17 @@ describe Praxis::ApiGeneralInfo do
|
|
4
4
|
|
5
5
|
subject(:info){ Praxis::ApiGeneralInfo.new }
|
6
6
|
|
7
|
+
before do
|
8
|
+
allow(Praxis::Application.instance).to receive(:versioning_scheme=).with([:header, :params])
|
9
|
+
end
|
10
|
+
|
11
|
+
|
7
12
|
let(:info_block) do
|
8
13
|
Proc.new do
|
9
14
|
name "Name"
|
10
15
|
title "Title"
|
11
16
|
description "Description"
|
17
|
+
endpoint 'api.example.com'
|
12
18
|
base_path "/base"
|
13
19
|
base_params do
|
14
20
|
attribute :name, String
|
@@ -45,6 +51,25 @@ describe Praxis::ApiGeneralInfo do
|
|
45
51
|
its([:base_path]) {should eq '/base' }
|
46
52
|
its([:base_params]) { should have_key :name }
|
47
53
|
its([:base_params, :name, :type, :name]) { should eq 'String' }
|
54
|
+
its([:version_with]) { should eq([:header, :params]) }
|
55
|
+
its([:endpoint]) { should eq 'api.example.com' }
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'base_path with versioning' do
|
59
|
+
let(:global_info){ Praxis::ApiGeneralInfo.new }
|
60
|
+
subject(:info){ Praxis::ApiGeneralInfo.new(global_info, version: '1.0') }
|
48
61
|
|
62
|
+
before do
|
63
|
+
global_info
|
64
|
+
|
65
|
+
expect(Praxis::Application.instance).to receive(:versioning_scheme=).with(:path)
|
66
|
+
|
67
|
+
global_info.version_with :path
|
68
|
+
global_info.base_path '/api/v:api_version'
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
its(:base_path) { should eq '/api/v1.0'}
|
49
73
|
end
|
74
|
+
|
50
75
|
end
|
@@ -48,17 +48,9 @@ describe Praxis::Application do
|
|
48
48
|
subject { Class.new(Praxis::Application).instance }
|
49
49
|
|
50
50
|
before do
|
51
|
-
|
52
|
-
allow(bootloader).to receive(:setup!).and_return(true)
|
53
|
-
|
54
|
-
app = double('built Rack app')
|
55
|
-
|
56
|
-
builder = double('Rack builder')
|
57
|
-
allow(builder).to receive(:run)
|
58
|
-
allow(builder).to receive(:to_app).and_return(app)
|
59
|
-
|
60
|
-
subject.instance_variable_set(:@bootloader, bootloader)
|
61
|
-
subject.instance_variable_set(:@builder, builder)
|
51
|
+
# don't actually bootload; we're merely running specs
|
52
|
+
allow(subject.bootloader).to receive(:setup!).and_return(true)
|
53
|
+
allow(subject.builder).to receive(:to_app).and_return(double('Rack app'))
|
62
54
|
end
|
63
55
|
|
64
56
|
describe '#handler' do
|
@@ -100,4 +92,25 @@ describe Praxis::Application do
|
|
100
92
|
end
|
101
93
|
end
|
102
94
|
end
|
95
|
+
|
96
|
+
describe '#setup' do
|
97
|
+
subject { Class.new(Praxis::Application).instance }
|
98
|
+
|
99
|
+
before do
|
100
|
+
# don't actually bootload; we're merely running specs
|
101
|
+
allow(subject.bootloader).to receive(:setup!).and_return(true)
|
102
|
+
allow(subject.builder).to receive(:to_app).and_return(double('Rack app'))
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'is idempotent' do
|
106
|
+
expect(subject.builder).to receive(:to_app).once
|
107
|
+
subject.setup
|
108
|
+
subject.setup
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'returns itself' do
|
112
|
+
expect(subject.setup).to eq(subject)
|
113
|
+
expect(subject.setup).to eq(subject)
|
114
|
+
end
|
115
|
+
end
|
103
116
|
end
|
@@ -3,8 +3,10 @@ require 'spec_helper'
|
|
3
3
|
describe Praxis::Handlers::XML do
|
4
4
|
|
5
5
|
describe '#parse' do
|
6
|
-
|
7
|
-
|
6
|
+
shared_examples 'xml something' do
|
7
|
+
it 'works' do
|
8
|
+
expect(subject.parse(parsed.to_xml)).to eq(parsed)
|
9
|
+
end
|
8
10
|
end
|
9
11
|
|
10
12
|
# XML_TYPE_NAMES = {
|
@@ -23,72 +25,81 @@ describe Praxis::Handlers::XML do
|
|
23
25
|
context "Parsing symbols" do
|
24
26
|
let(:xml){ '<objects type="array"><object type="symbol">a_symbol</object></objects>' }
|
25
27
|
let(:parsed){ [:a_symbol] }
|
26
|
-
|
28
|
+
it_behaves_like 'xml something'
|
27
29
|
end
|
28
30
|
|
29
31
|
context "Parsing integers" do
|
30
32
|
let(:xml){ '<objects type="array"><object type="integer">1234</object></objects>' }
|
31
33
|
let(:parsed){ [1234] }
|
32
|
-
|
34
|
+
it_behaves_like 'xml something'
|
33
35
|
end
|
34
36
|
|
35
37
|
context "Parsing decimals" do
|
36
38
|
let(:xml){ '<objects type="array"><object type="decimal">0.1</object></objects>' }
|
37
39
|
let(:parsed){ [0.1] }
|
38
|
-
|
40
|
+
it_behaves_like 'xml something'
|
39
41
|
end
|
40
42
|
|
41
43
|
context "Parsing floats" do
|
42
44
|
let(:xml){ '<objects type="array"><object type="float">0.1</object></objects>' }
|
43
45
|
let(:parsed){ [0.1] }
|
44
|
-
|
46
|
+
it_behaves_like 'xml something'
|
45
47
|
end
|
46
48
|
|
47
49
|
context "Parsing booleans" do
|
48
50
|
context "that are true" do
|
49
51
|
let(:xml){ '<objects type="array"><object type="boolean">true</object></objects>' }
|
50
52
|
let(:parsed){ [true] }
|
51
|
-
|
53
|
+
it_behaves_like 'xml something'
|
52
54
|
end
|
53
55
|
context "that are false" do
|
54
56
|
let(:xml){ '<objects type="array"><object type="boolean">false</object></objects>' }
|
55
57
|
let(:parsed){ [false] }
|
56
|
-
|
58
|
+
it_behaves_like 'xml something'
|
59
|
+
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
60
63
|
context "Parsing dates" do
|
61
64
|
let(:xml){ '<objects type="array"><object type="date">2001-01-01</object></objects>' }
|
62
65
|
let(:parsed){ [Date.parse("2001-01-01")] }
|
63
|
-
|
66
|
+
it_behaves_like 'xml something'
|
64
67
|
end
|
65
68
|
|
66
69
|
context "Parsing dateTimes" do
|
67
70
|
let(:xml){ '<objects type="array"><object type="dateTime">2015-03-13T19:34:40-07:00</object></objects>' }
|
68
71
|
let(:parsed){ [DateTime.parse("2015-03-13T19:34:40-07:00")] }
|
69
|
-
|
72
|
+
it_behaves_like 'xml something'
|
70
73
|
end
|
71
74
|
|
72
75
|
context "Parsing hashes" do
|
73
76
|
context "that are empty" do
|
74
|
-
let(:xml){
|
75
|
-
|
76
|
-
it '
|
77
|
+
let(:xml){ "<hash></hash>" }
|
78
|
+
|
79
|
+
it 'get converted to empty strings' do
|
80
|
+
expect(subject.parse(xml)).to eq('')
|
81
|
+
end
|
77
82
|
end
|
83
|
+
|
78
84
|
context "with a couple of elements" do
|
79
85
|
let(:xml){ '<hash><one type="integer">1</one><two type="integer">2</two></hash>' }
|
80
86
|
let(:parsed){ {"one"=>1, "two"=>2} }
|
81
|
-
|
87
|
+
it_behaves_like 'xml something'
|
88
|
+
end
|
89
|
+
context "with hyphenated elements" do
|
90
|
+
let(:xml){ '<hash><part-one type="integer">1</part-one><part-two type="integer">2</part-two></hash>' }
|
91
|
+
let(:parsed){ {"part_one"=>1, "part_two"=>2} }
|
92
|
+
it_behaves_like 'xml something'
|
82
93
|
end
|
83
94
|
context "with a nested hash" do
|
84
95
|
let(:xml){ '<hash><one type="integer">1</one><sub_hash><first>hello</first></sub_hash></hash>' }
|
85
96
|
let(:parsed){ {"one"=>1, "sub_hash"=>{"first"=>"hello"} } }
|
86
|
-
|
97
|
+
it_behaves_like 'xml something'
|
87
98
|
end
|
88
99
|
context "with a nested array" do
|
89
100
|
let(:xml){ '<hash><one type="integer">1</one><two type="array"><object>just text</object></two></hash>' }
|
90
101
|
let(:parsed){ {"one"=>1, "two" => ["just text"] } }
|
91
|
-
|
102
|
+
it_behaves_like 'xml something'
|
92
103
|
end
|
93
104
|
|
94
105
|
end
|
@@ -97,12 +108,12 @@ describe Praxis::Handlers::XML do
|
|
97
108
|
context 'with a couple of simple elements in it' do
|
98
109
|
let(:xml){ '<objects type="array"><object>just text</object><object type="integer">1</object></objects>' }
|
99
110
|
let(:parsed){ ["just text", 1] }
|
100
|
-
|
111
|
+
it_behaves_like 'xml something'
|
101
112
|
end
|
102
113
|
context "with a nested hash" do
|
103
114
|
let(:xml){ '<objects type="array"><object>just text</object><object><one type="integer">1</one></object></objects>' }
|
104
115
|
let(:parsed){ ["just text", { "one" => 1}] }
|
105
|
-
|
116
|
+
it_behaves_like 'xml something'
|
106
117
|
end
|
107
118
|
end
|
108
119
|
|
@@ -110,40 +121,51 @@ describe Praxis::Handlers::XML do
|
|
110
121
|
let(:xml){ parsed.to_xml }
|
111
122
|
context 'array with a couple of simple elements in it' do
|
112
123
|
let(:parsed){ ["just text", 1] }
|
113
|
-
|
124
|
+
it_behaves_like 'xml something'
|
114
125
|
end
|
115
126
|
context 'a hash with a couple of simple elements in it' do
|
116
127
|
let(:parsed){ { "one"=>"just text", "two"=> 1 } }
|
117
|
-
|
128
|
+
it_behaves_like 'xml something'
|
118
129
|
end
|
119
130
|
context 'a array with elements of all types' do
|
120
131
|
let(:parsed){ ["just text",:a,1,BigDecimal.new(100),0.1,true,Date.new] }
|
121
|
-
|
132
|
+
it_behaves_like 'xml something'
|
122
133
|
end
|
123
134
|
context 'a hash with a complex substructure' do
|
124
135
|
let(:parsed) do
|
125
136
|
Hash(
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
137
|
+
"text" => "just text",
|
138
|
+
"symbol" => :a,
|
139
|
+
"num" => 1,
|
140
|
+
"bd" => BigDecimal.new(100),
|
141
|
+
"float" => 0.1,
|
142
|
+
"truthyness" => true,
|
143
|
+
"day" => Date.new,
|
144
|
+
"empty_string" => ""
|
145
|
+
)
|
133
146
|
end
|
134
|
-
|
147
|
+
it_behaves_like 'xml something'
|
135
148
|
end
|
136
149
|
|
137
150
|
context "transformed characters when using .to_xml" do
|
138
151
|
context 'underscores become dashes' do
|
139
152
|
let(:xml){ {"one_thing"=>1, "two_things"=>2}.to_xml }
|
140
|
-
|
141
|
-
|
153
|
+
it do
|
154
|
+
doc = Nokogiri::XML(xml)
|
155
|
+
|
156
|
+
expect(doc.search('one-thing')).to_not be_empty
|
157
|
+
expect(doc.search('two-things')).to_not be_empty
|
158
|
+
end
|
142
159
|
end
|
143
160
|
context 'spaces become dashes' do
|
144
161
|
let(:xml){ {"one thing"=>1, "two things"=>2}.to_xml }
|
145
162
|
let(:parsed){ {"one-thing"=>1, "two-things"=>2} }
|
146
|
-
it
|
163
|
+
it do
|
164
|
+
doc = Nokogiri::XML(xml)
|
165
|
+
|
166
|
+
expect(doc.search('one-thing')).to_not be_empty
|
167
|
+
expect(doc.search('two-things')).to_not be_empty
|
168
|
+
end
|
147
169
|
end
|
148
170
|
end
|
149
171
|
end
|
@@ -152,4 +174,4 @@ describe Praxis::Handlers::XML do
|
|
152
174
|
it 'has tests'
|
153
175
|
end
|
154
176
|
end
|
155
|
-
end
|
177
|
+
end
|
data/spec/praxis/links_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Praxis::Links do
|
|
19
19
|
expect(link.for(Address)).to eq(link)
|
20
20
|
end
|
21
21
|
|
22
|
-
context '
|
22
|
+
context 'contents' do
|
23
23
|
subject(:view) { link.view(:default) }
|
24
24
|
|
25
25
|
its(:name) { should eq(:default) }
|
@@ -28,6 +28,23 @@ describe Praxis::Links do
|
|
28
28
|
its(:contents) { should have_key(:super) }
|
29
29
|
end
|
30
30
|
|
31
|
+
context 'rendering' do
|
32
|
+
let(:example){ Address.example }
|
33
|
+
context 'for :default' do
|
34
|
+
subject(:rendered_links){ example.render(view: :default)[:links] }
|
35
|
+
|
36
|
+
it 'should use the :link for rendering its attributes' do
|
37
|
+
expect(rendered_links[:owner]).to eq( example.owner.render(view: :link))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
context 'for :master' do
|
41
|
+
subject(:rendered_links){ example.render(view: :master)[:links] }
|
42
|
+
it 'should use the :link for rendering its attributes' do
|
43
|
+
expect(rendered_links[:owner]).to eq( example.owner.render(view: :link))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
31
48
|
context '.example' do
|
32
49
|
subject(:example) { Address.example }
|
33
50
|
|
@@ -78,7 +78,7 @@ describe Praxis::MediaTypeCollection do
|
|
78
78
|
context 'for standard views' do
|
79
79
|
let(:snapshots_data) { {name: 'snapshots', href: '/bob/snapshots' } }
|
80
80
|
let(:snapshots) { media_type_collection.load(snapshots_data) }
|
81
|
-
subject(:output) { snapshots.render(:link) }
|
81
|
+
subject(:output) { snapshots.render(view: :link) }
|
82
82
|
|
83
83
|
its([:name]) { should eq(snapshots.name)}
|
84
84
|
its([:size]) { should eq(snapshots.size)}
|
@@ -96,7 +96,7 @@ describe Praxis::MediaType do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
context "rendering" do
|
99
|
-
subject(:output) { address.render(:default) }
|
99
|
+
subject(:output) { address.render(view: :default) }
|
100
100
|
|
101
101
|
its([:id]) { should eq(address.id) }
|
102
102
|
its([:name]) { should eq(address.name) }
|
@@ -112,7 +112,7 @@ describe Praxis::MediaType do
|
|
112
112
|
context 'for a collection summary' do
|
113
113
|
let(:volume) { Volume.example }
|
114
114
|
let(:snapshots_summary) { volume.snapshots_summary }
|
115
|
-
let(:output) { volume.render(:default) }
|
115
|
+
let(:output) { volume.render(view: :default) }
|
116
116
|
subject { links[:snapshots] }
|
117
117
|
|
118
118
|
its([:name]) { should eq(snapshots_summary.name) }
|
@@ -19,11 +19,14 @@ describe Praxis::MultipartParser do
|
|
19
19
|
subject(:parts) { parser.parse[1] }
|
20
20
|
|
21
21
|
context 'with simple parts' do
|
22
|
+
it { should be_kind_of(Array) }
|
22
23
|
it { should have(1).item }
|
23
|
-
it { should have_key('destination_path') }
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
context 'the parsed parts' do
|
26
|
+
subject(:part) { parts.first }
|
27
|
+
|
28
|
+
its(:name) { should eq 'destination_path' }
|
29
|
+
its(:body) { should eq '/etc/defaults' }
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
@@ -33,20 +36,25 @@ describe Praxis::MultipartParser do
|
|
33
36
|
form.add text, 'file', 'docker'
|
34
37
|
end
|
35
38
|
|
36
|
-
subject(:
|
39
|
+
subject(:part) { parts.find { |p| p.name == 'file'} }
|
40
|
+
#subject(:part_body) { part.body }
|
41
|
+
|
37
42
|
|
38
|
-
|
39
|
-
its(
|
40
|
-
its(
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
its(:payload) { should be_kind_of(Tempfile) }
|
44
|
+
its(:filename) { should eq("docker") }
|
45
|
+
its(:name) { should eq("file") }
|
46
|
+
|
47
|
+
context 'headers' do
|
48
|
+
subject(:part_headers) { part.headers }
|
49
|
+
its(['Content-Type']) { should eq("text/plain") }
|
50
|
+
its(['Content-Disposition']) { should match(/filename=docker/) }
|
51
|
+
end
|
44
52
|
|
45
53
|
it 'saves the value to the tempfile' do
|
46
|
-
expect(File.exist?(
|
54
|
+
expect(File.exist?(part.payload.path)).to be(true)
|
47
55
|
|
48
|
-
|
49
|
-
expect(
|
56
|
+
part.payload.rewind
|
57
|
+
expect(part.payload.read).to eq('DOCKER_HOST=tcp://127.0.0.1:2375')
|
50
58
|
end
|
51
59
|
|
52
60
|
end
|