apipierails3 0.0.1

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 (171) hide show
  1. checksums.yaml +17 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +27 -0
  5. data/APACHE-LICENSE-2.0 +202 -0
  6. data/CHANGELOG.md +469 -0
  7. data/Gemfile +1 -0
  8. data/Gemfile.rails32 +6 -0
  9. data/Gemfile.rails41 +6 -0
  10. data/Gemfile.rails42 +11 -0
  11. data/Gemfile.rails50 +6 -0
  12. data/Gemfile.rails51 +7 -0
  13. data/MIT-LICENSE +20 -0
  14. data/NOTICE +4 -0
  15. data/PROPOSAL_FOR_RESPONSE_DESCRIPTIONS.md +244 -0
  16. data/README.rst +1874 -0
  17. data/Rakefile +13 -0
  18. data/apipierails3.gemspec +27 -0
  19. data/app/controllers/apipie/apipies_controller.rb +199 -0
  20. data/app/helpers/apipie_helper.rb +10 -0
  21. data/app/public/apipie/javascripts/apipie.js +6 -0
  22. data/app/public/apipie/javascripts/bundled/bootstrap-collapse.js +138 -0
  23. data/app/public/apipie/javascripts/bundled/bootstrap.js +1726 -0
  24. data/app/public/apipie/javascripts/bundled/jquery.js +5 -0
  25. data/app/public/apipie/javascripts/bundled/prettify.js +28 -0
  26. data/app/public/apipie/stylesheets/application.css +7 -0
  27. data/app/public/apipie/stylesheets/bundled/bootstrap-responsive.min.css +12 -0
  28. data/app/public/apipie/stylesheets/bundled/bootstrap.min.css +689 -0
  29. data/app/public/apipie/stylesheets/bundled/prettify.css +30 -0
  30. data/app/views/apipie/apipies/_disqus.html.erb +13 -0
  31. data/app/views/apipie/apipies/_errors.html.erb +23 -0
  32. data/app/views/apipie/apipies/_headers.html.erb +26 -0
  33. data/app/views/apipie/apipies/_languages.erb +6 -0
  34. data/app/views/apipie/apipies/_metadata.erb +1 -0
  35. data/app/views/apipie/apipies/_method_detail.erb +61 -0
  36. data/app/views/apipie/apipies/_params.html.erb +42 -0
  37. data/app/views/apipie/apipies/_params_plain.html.erb +20 -0
  38. data/app/views/apipie/apipies/apipie_404.html.erb +17 -0
  39. data/app/views/apipie/apipies/apipie_checksum.json.erb +1 -0
  40. data/app/views/apipie/apipies/getting_started.html.erb +6 -0
  41. data/app/views/apipie/apipies/index.html.erb +56 -0
  42. data/app/views/apipie/apipies/method.html.erb +41 -0
  43. data/app/views/apipie/apipies/plain.html.erb +77 -0
  44. data/app/views/apipie/apipies/resource.html.erb +80 -0
  45. data/app/views/apipie/apipies/static.html.erb +103 -0
  46. data/app/views/layouts/apipie/apipie.html.erb +27 -0
  47. data/config/locales/de.yml +28 -0
  48. data/config/locales/en.yml +32 -0
  49. data/config/locales/es.yml +28 -0
  50. data/config/locales/fr.yml +31 -0
  51. data/config/locales/it.yml +31 -0
  52. data/config/locales/ja.yml +31 -0
  53. data/config/locales/pl.yml +28 -0
  54. data/config/locales/pt-BR.yml +28 -0
  55. data/config/locales/ru.yml +28 -0
  56. data/config/locales/tr.yml +28 -0
  57. data/config/locales/zh-CN.yml +28 -0
  58. data/config/locales/zh-TW.yml +28 -0
  59. data/images/screenshot-1.png +0 -0
  60. data/images/screenshot-2.png +0 -0
  61. data/lib/apipie/apipie_module.rb +83 -0
  62. data/lib/apipie/application.rb +462 -0
  63. data/lib/apipie/configuration.rb +186 -0
  64. data/lib/apipie/dsl_definition.rb +607 -0
  65. data/lib/apipie/error_description.rb +44 -0
  66. data/lib/apipie/errors.rb +86 -0
  67. data/lib/apipie/extractor.rb +177 -0
  68. data/lib/apipie/extractor/collector.rb +117 -0
  69. data/lib/apipie/extractor/recorder.rb +166 -0
  70. data/lib/apipie/extractor/writer.rb +454 -0
  71. data/lib/apipie/helpers.rb +73 -0
  72. data/lib/apipie/markup.rb +48 -0
  73. data/lib/apipie/method_description.rb +273 -0
  74. data/lib/apipie/middleware/checksum_in_headers.rb +35 -0
  75. data/lib/apipie/param_description.rb +280 -0
  76. data/lib/apipie/railtie.rb +9 -0
  77. data/lib/apipie/resource_description.rb +124 -0
  78. data/lib/apipie/response_description.rb +131 -0
  79. data/lib/apipie/response_description_adapter.rb +200 -0
  80. data/lib/apipie/routes_formatter.rb +33 -0
  81. data/lib/apipie/routing.rb +16 -0
  82. data/lib/apipie/rspec/response_validation_helper.rb +192 -0
  83. data/lib/apipie/see_description.rb +39 -0
  84. data/lib/apipie/static_dispatcher.rb +69 -0
  85. data/lib/apipie/swagger_generator.rb +707 -0
  86. data/lib/apipie/tag_list_description.rb +11 -0
  87. data/lib/apipie/validator.rb +526 -0
  88. data/lib/apipie/version.rb +3 -0
  89. data/lib/apipierails3.rb +25 -0
  90. data/lib/generators/apipie/install/README +6 -0
  91. data/lib/generators/apipie/install/install_generator.rb +25 -0
  92. data/lib/generators/apipie/install/templates/initializer.rb.erb +7 -0
  93. data/lib/generators/apipie/views_generator.rb +11 -0
  94. data/lib/tasks/apipie.rake +345 -0
  95. data/rel-eng/packages/.readme +3 -0
  96. data/rel-eng/packages/rubygem-apipie-rails +1 -0
  97. data/rel-eng/tito.props +5 -0
  98. data/spec/controllers/api/v1/architectures_controller_spec.rb +29 -0
  99. data/spec/controllers/api/v2/architectures_controller_spec.rb +12 -0
  100. data/spec/controllers/api/v2/nested/resources_controller_spec.rb +11 -0
  101. data/spec/controllers/apipies_controller_spec.rb +273 -0
  102. data/spec/controllers/concerns_controller_spec.rb +42 -0
  103. data/spec/controllers/extended_controller_spec.rb +11 -0
  104. data/spec/controllers/users_controller_spec.rb +740 -0
  105. data/spec/dummy/Rakefile +7 -0
  106. data/spec/dummy/app/controllers/api/base_controller.rb +4 -0
  107. data/spec/dummy/app/controllers/api/v1/architectures_controller.rb +43 -0
  108. data/spec/dummy/app/controllers/api/v1/base_controller.rb +11 -0
  109. data/spec/dummy/app/controllers/api/v2/architectures_controller.rb +30 -0
  110. data/spec/dummy/app/controllers/api/v2/base_controller.rb +11 -0
  111. data/spec/dummy/app/controllers/api/v2/nested/architectures_controller.rb +32 -0
  112. data/spec/dummy/app/controllers/api/v2/nested/resources_controller.rb +33 -0
  113. data/spec/dummy/app/controllers/application_controller.rb +18 -0
  114. data/spec/dummy/app/controllers/concerns/extending_concern.rb +11 -0
  115. data/spec/dummy/app/controllers/concerns/sample_controller.rb +41 -0
  116. data/spec/dummy/app/controllers/concerns_controller.rb +8 -0
  117. data/spec/dummy/app/controllers/extended_controller.rb +14 -0
  118. data/spec/dummy/app/controllers/files_controller.rb +5 -0
  119. data/spec/dummy/app/controllers/overridden_concerns_controller.rb +31 -0
  120. data/spec/dummy/app/controllers/pets_controller.rb +408 -0
  121. data/spec/dummy/app/controllers/pets_using_auto_views_controller.rb +73 -0
  122. data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +95 -0
  123. data/spec/dummy/app/controllers/tagged_cats_controller.rb +32 -0
  124. data/spec/dummy/app/controllers/tagged_dogs_controller.rb +15 -0
  125. data/spec/dummy/app/controllers/twitter_example_controller.rb +307 -0
  126. data/spec/dummy/app/controllers/users_controller.rb +297 -0
  127. data/spec/dummy/app/views/layouts/application.html.erb +21 -0
  128. data/spec/dummy/config.ru +4 -0
  129. data/spec/dummy/config/application.rb +49 -0
  130. data/spec/dummy/config/boot.rb +10 -0
  131. data/spec/dummy/config/database.yml +21 -0
  132. data/spec/dummy/config/environment.rb +8 -0
  133. data/spec/dummy/config/environments/development.rb +28 -0
  134. data/spec/dummy/config/environments/production.rb +52 -0
  135. data/spec/dummy/config/environments/test.rb +38 -0
  136. data/spec/dummy/config/initializers/apipie.rb +110 -0
  137. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  138. data/spec/dummy/config/initializers/inflections.rb +10 -0
  139. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  140. data/spec/dummy/config/initializers/secret_token.rb +8 -0
  141. data/spec/dummy/config/initializers/session_store.rb +8 -0
  142. data/spec/dummy/config/locales/en.yml +5 -0
  143. data/spec/dummy/config/routes.rb +51 -0
  144. data/spec/dummy/db/.gitkeep +0 -0
  145. data/spec/dummy/doc/apipie_examples.json +1 -0
  146. data/spec/dummy/doc/users/desc_from_file.md +1 -0
  147. data/spec/dummy/public/404.html +26 -0
  148. data/spec/dummy/public/422.html +26 -0
  149. data/spec/dummy/public/500.html +26 -0
  150. data/spec/dummy/public/favicon.ico +0 -0
  151. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  152. data/spec/dummy/script/rails +6 -0
  153. data/spec/lib/application_spec.rb +49 -0
  154. data/spec/lib/extractor/extractor_spec.rb +9 -0
  155. data/spec/lib/extractor/middleware_spec.rb +44 -0
  156. data/spec/lib/extractor/writer_spec.rb +110 -0
  157. data/spec/lib/file_handler_spec.rb +18 -0
  158. data/spec/lib/method_description_spec.rb +98 -0
  159. data/spec/lib/param_description_spec.rb +345 -0
  160. data/spec/lib/param_group_spec.rb +60 -0
  161. data/spec/lib/rake_spec.rb +71 -0
  162. data/spec/lib/resource_description_spec.rb +48 -0
  163. data/spec/lib/swagger/openapi_2_0_schema.json +1607 -0
  164. data/spec/lib/swagger/rake_swagger_spec.rb +139 -0
  165. data/spec/lib/swagger/response_validation_spec.rb +104 -0
  166. data/spec/lib/swagger/swagger_dsl_spec.rb +658 -0
  167. data/spec/lib/validator_spec.rb +113 -0
  168. data/spec/lib/validators/array_validator_spec.rb +85 -0
  169. data/spec/spec_helper.rb +109 -0
  170. data/spec/support/rake.rb +21 -0
  171. metadata +415 -0
@@ -0,0 +1,52 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ # config.serve_static_assets = true
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+
50
+ # Eager load code on boot (Rails 5)
51
+ config.eager_load = true
52
+ end
@@ -0,0 +1,38 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+
36
+ # Do not eager load code on boot. (Rails 5)
37
+ config.eager_load = false
38
+ end
@@ -0,0 +1,110 @@
1
+ Apipie.configure do |config|
2
+ config.app_name = "Test app"
3
+ config.copyright = "© 2012 Pavel Pokorny"
4
+ config.languages = ['en']
5
+ config.default_locale = 'en'
6
+
7
+ # set default API version
8
+ # can be overriden in resource_description
9
+ # by default is it 1.0 if not specified anywhere
10
+ # this must be defined before api_base_url and app_info
11
+ config.default_version = "development".freeze
12
+
13
+ config.doc_base_url = "/apidoc"
14
+
15
+ # default version base url
16
+ # to define base url for specifid version use
17
+ # config.api_base_url[version] = url
18
+ # or define it in your base controller
19
+ config.api_base_url = "/api"
20
+
21
+ # set to true to turn on/off the cache. To generate the cache use:
22
+ #
23
+ # rake apipie:cache
24
+ #
25
+ config.use_cache = Rails.env.production?
26
+ # config.cache_dir = File.join(Rails.root, "public", "apipie-cache") # optional
27
+
28
+ # set to enable/disable reloading controllers (and the documentation with it),
29
+ # by default enabled in development
30
+ # config.reload_controllers = false
31
+
32
+ # for reloading to work properly you need to specify where your api controllers are (like in Dir.glob):
33
+ config.api_controllers_matcher = File.join(Rails.root, "app", "controllers", "**","*.rb")
34
+
35
+ # specify routes if your application uses router differ from Rails default one
36
+ config.api_routes = Rails.application.routes
37
+
38
+ # config.markup = choose one of:
39
+ # Apipie::Markup::RDoc.new [default]
40
+ # Apipie::Markup::Markdown.new
41
+ # Apipie::Markup::Textile.new
42
+ # or provide another class with to_html(text) instance method
43
+ # to disable markup, use
44
+ # config.markup = nil
45
+
46
+ config.validate = false
47
+
48
+ # set all parameters as required by default
49
+ # if enabled, use param :name, val, :required => false for optional params
50
+ config.required_by_default = false
51
+
52
+ # set default version info, to describe specific version use
53
+ # config.app_info[version] = description
54
+ # or put this in your base or application controller
55
+ config.app_info = "Dummy app for testing"
56
+
57
+ # show debug informations
58
+ config.debug = false
59
+
60
+ # set all parameters as required by default
61
+ # if enabled, use param :name, val, :required => false for optional params
62
+ config.required_by_default = false
63
+
64
+ # use custom layout
65
+ # use Apipie.include_stylesheets and Apipie.include_javascripts
66
+ # to include apipies css and js
67
+ config.layout = "application"
68
+
69
+ # specify disqus site shortname to show discusion on each page
70
+ # to show it in custom layout, use `render 'disqus' if Apipie.configuration.use_disqus?`
71
+ # config.disqus_shortname = 'paveltest'
72
+
73
+ # Hide '.html' extensions. Note that '.html' extensions are forced
74
+ # when generating static documentation
75
+ # config.link_extension = ""
76
+ end
77
+
78
+ # integer validator
79
+ class Apipie::Validator::IntegerValidator < Apipie::Validator::BaseValidator
80
+
81
+ def initialize(param_description, argument)
82
+ super(param_description)
83
+ @type = argument
84
+ end
85
+
86
+ def validate(value)
87
+ return false if value.nil?
88
+ !!(value.to_s =~ /^[-+]?[0-9]+$/)
89
+ end
90
+
91
+ def self.build(param_description, argument, options, block)
92
+ if argument == Integer || argument == Fixnum
93
+ self.new(param_description, argument)
94
+ end
95
+ end
96
+
97
+ def error
98
+ # Newer style is to return an instance of ParamInvalid. Keeping this
99
+ # to test backwards compatibility.
100
+ "Parameter #{param_name} expecting to be #{@type.name}, got: #{@error_value.class.name}"
101
+ end
102
+
103
+ def description
104
+ "Parameter has to be #{@type}."
105
+ end
106
+
107
+ def expected_type
108
+ 'numeric'
109
+ end
110
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = '431a859f504c40942b0caa3a740492b8bfd87c7898db4b1c39557f440f1cdda99c54810ad81f6ba7e1cece75bc079caa52a5cb54dbd085effd038ba283b837ce'
8
+ Dummy::Application.config.secret_key_base = '431a859f504c40942b0caa3a740492b8bfd87c7898db4b1c39557f440f1cdda99c54810ad81f6ba7e1cece75bc079caa52a5cb54dbd085effd038ba283b837ce'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,51 @@
1
+ Dummy::Application.routes.draw do
2
+
3
+ scope ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
4
+
5
+ scope '/api' do
6
+ resources :users do
7
+ collection do
8
+ post :create_route
9
+ end
10
+ end
11
+ resources :concerns, :only => [:index, :show]
12
+ namespace :files do
13
+ get '/*file_path', format: false, :action => 'download'
14
+ end
15
+
16
+ # This is not directly used in the specs.
17
+ # It is only there to tests apipies tolerance regarding
18
+ # missing controllers.
19
+ resources :dangeling_stuff
20
+ resources :twitter_example do
21
+ collection do
22
+ get :lookup
23
+ get 'profile_image/:screen_name' => 'twitter_example#profile_image'
24
+ get :search
25
+ get :search
26
+ get :contributors
27
+ end
28
+ end
29
+
30
+ get "/pets/return_and_validate_expected_response" => "pets#return_and_validate_expected_response"
31
+ get "/pets/return_and_validate_expected_array_response" => "pets#return_and_validate_expected_array_response"
32
+ get "/pets/return_and_validate_type_mismatch" => "pets#return_and_validate_type_mismatch"
33
+ get "/pets/return_and_validate_missing_field" => "pets#return_and_validate_missing_field"
34
+ get "/pets/return_and_validate_extra_property" => "pets#return_and_validate_extra_property"
35
+ get "/pets/return_and_validate_allowed_extra_property" => "pets#return_and_validate_allowed_extra_property"
36
+ get "/pets/sub_object_invalid_extra_property" => "pets#sub_object_invalid_extra_property"
37
+ get "/pets/sub_object_allowed_extra_property" => "pets#sub_object_allowed_extra_property"
38
+ get "/pets/return_and_validate_unexpected_array_response" => "pets#return_and_validate_unexpected_array_response"
39
+ get "/pets/return_and_validate_expected_response_with_null" => "pets#return_and_validate_expected_response_with_null"
40
+ get "/pets/return_and_validate_expected_response_with_null_object" => "pets#return_and_validate_expected_response_with_null_object"
41
+
42
+ get "/pets/returns_response_with_valid_array" => "pets#returns_response_with_valid_array"
43
+ get "/pets/returns_response_with_invalid_array" => "pets#returns_response_with_invalid_array"
44
+ get "/pets/undocumented_method" => "pets#undocumented_method"
45
+ end
46
+
47
+ apipie
48
+ end
49
+ root :to => 'apipie/apipies#index'
50
+ match '(/)*path' => redirect('http://www.example.com'), :via => :all
51
+ end
File without changes
@@ -0,0 +1 @@
1
+ {"users#show":[{"verb":"GET","path":"/users/15","query":null,"request_data":null,"response_data":null,"code":"404","show_in_doc":2,"recorded":true},{"verb":"GET","path":"/users/14","query":"verbose=true","request_data":null,"response_data":"{\n \"name\": \"Test User\"\n}","code":"200","show_in_doc":1,"recorded":true},{"verb":"GET","path":"/users/15","query":"verbose=true","request_data":null,"response_data":"{\n \"name\": \"Test User\"\n}","code":"200","show_in_doc":0,"recorded":true}]}
@@ -0,0 +1 @@
1
+ description from document
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,49 @@
1
+ require "spec_helper"
2
+
3
+ describe Apipie::Application do
4
+
5
+ describe "api_controllers_paths" do
6
+ before { Apipie.configuration.api_controllers_matcher = [File.join(Rails.root, "app", "controllers", "**","*.rb"), File.join(Rails.root, "lib", "**","*.rb")] }
7
+
8
+ it "should support receiving array as parameter" do
9
+ expect { Apipie.api_controllers_paths}.
10
+ not_to raise_error
11
+ end
12
+
13
+
14
+ end
15
+
16
+ describe "get_resource_name" do
17
+ subject {Apipie.get_resource_name(Api::V2::Nested::ArchitecturesController)}
18
+
19
+ context "with namespaced_resources enabled" do
20
+ before { Apipie.configuration.namespaced_resources = true }
21
+ context "with a defined base url" do
22
+
23
+ it "should not overwrite the parent resource" do
24
+ is_expected.not_to eq(Apipie.get_resource_name(Api::V2::ArchitecturesController))
25
+ end
26
+
27
+ end
28
+
29
+ context "with an undefined base url" do
30
+ before {allow(Apipie.app).to receive(:get_base_url) { nil }}
31
+
32
+ it "should not raise an error" do
33
+ expect { Apipie.get_resource_name(Api::V2::ArchitecturesController) }.
34
+ not_to raise_error
35
+ end
36
+ end
37
+
38
+ after { Apipie.configuration.namespaced_resources = false }
39
+ end
40
+
41
+ context "with namespaced_resources enabled" do
42
+ before { Apipie.configuration.namespaced_resources = false }
43
+
44
+ it "should overwrite the the parent" do
45
+ is_expected.to eq(Apipie.get_resource_name(Api::V2::ArchitecturesController))
46
+ end
47
+ end
48
+ end
49
+ end