rapidoc 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,7 +51,6 @@ module Dummy
51
51
  # This will create an empty whitelist of attributes available for mass-assignment for all models
52
52
  # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
53
53
  # parameters by using an attr_accessible or attr_protected declaration.
54
- config.active_record.whitelist_attributes = true
55
54
 
56
55
  # Enable the asset pipeline
57
56
  config.assets.enabled = true
@@ -1,37 +1,80 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
8
6
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
11
12
 
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
15
16
 
16
- # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
18
21
 
19
- # Print deprecation notices to the Rails logger
20
- config.active_support.deprecation = :log
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = true
21
24
 
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
24
28
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
27
31
 
28
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
31
34
 
32
- # Do not compress assets
33
- config.assets.compress = false
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
34
37
 
35
- # Expands the lines which load the assets
36
- config.assets.debug = true
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
37
80
  end
@@ -1,67 +1,80 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
- # Full error reports are disabled and caching is turned on
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
8
14
  config.consider_all_requests_local = false
9
15
  config.action_controller.perform_caching = true
10
16
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = true
13
24
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
16
28
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
18
30
  config.assets.compile = false
19
31
 
20
- # Generate digests for assets URLs
32
+ # Generate digests for assets URLs.
21
33
  config.assets.digest = true
22
34
 
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
25
37
 
26
- # Specifies the header that your server uses for sending files
38
+ # Specifies the header that your server uses for sending files.
27
39
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
40
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
41
 
30
42
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
43
  # config.force_ssl = true
32
44
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
35
47
 
36
- # Prepend all log lines with the following tags
48
+ # Prepend all log lines with the following tags.
37
49
  # config.log_tags = [ :subdomain, :uuid ]
38
50
 
39
- # Use a different logger for distributed setups
51
+ # Use a different logger for distributed setups.
40
52
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
53
 
42
- # Use a different cache store in production
54
+ # Use a different cache store in production.
43
55
  # config.cache_store = :mem_cache_store
44
56
 
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
46
58
  # config.action_controller.asset_host = "http://assets.example.com"
47
59
 
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
49
62
  # config.assets.precompile += %w( search.js )
50
63
 
51
- # Disable delivery errors, bad email addresses will be ignored
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52
66
  # config.action_mailer.raise_delivery_errors = false
53
67
 
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
68
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
69
+ # the I18n.default_locale when a translation can not be found).
59
70
  config.i18n.fallbacks = true
60
71
 
61
- # Send deprecation notices to registered listeners
72
+ # Send deprecation notices to registered listeners.
62
73
  config.active_support.deprecation = :notify
63
74
 
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
67
80
  end
@@ -1,37 +1,80 @@
1
1
  Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
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!
4
+ # Code is not reloaded between requests.
8
5
  config.cache_classes = true
9
6
 
10
- # Configure static asset server for tests with Cache-Control for performance
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
11
23
  config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
13
24
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
16
59
 
17
- # Show full error reports and disable caching
18
- config.consider_all_requests_local = true
19
- config.action_controller.perform_caching = false
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
20
63
 
21
- # Raise exceptions instead of rendering exception templates
22
- config.action_dispatch.show_exceptions = false
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
23
67
 
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
26
71
 
27
- # Tell Action Mailer not to deliver emails to the real world.
28
- # The :test delivery method accumulates sent emails in the
29
- # ActionMailer::Base.deliveries array.
30
- config.action_mailer.delivery_method = :test
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
31
74
 
32
- # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
34
77
 
35
- # Print deprecation notices to the stderr
36
- config.active_support.deprecation = :stderr
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
37
80
  end
@@ -1,6 +1,6 @@
1
1
  Dummy::Application.routes.draw do
2
- match 'testing', :to => 'testing#redirect', :constraints => { :id => /[A-Z]\d{5}/ }
3
- match '*tests', :controller => 'testing', :action => 'index'
2
+ match 'testing', :to => 'testing#redirect', :via => :get, :constraints => { :id => /[A-Z]\d{5}/ }
3
+ match '*tests', :controller => 'testing', :action => 'index', :via => :get
4
4
 
5
5
  resources :users, :only => [ :index, :show, :create ] do
6
6
  resources :albums, :only => [ :index, :show, :create, :update, :destroy ] do
@@ -14,9 +14,10 @@ describe "Action page" do
14
14
  reset_structure
15
15
 
16
16
  @json_info = { "user" => { "name" => "Check", "apellido" => "Me" } }
17
- request_file = examples_dir "users_create_request.json"
18
- response_file = examples_dir "users_create_response.json"
17
+ request_file = examples_dir "users/create_request.json"
18
+ response_file = examples_dir "users/create_response.json"
19
19
 
20
+ create_folders_for_files([response_file, request_file])
20
21
  File.open( request_file, 'w') { |file| file.write @json_info.to_json }
21
22
  File.open( response_file, 'w') { |file| file.write @json_info.to_json }
22
23
 
@@ -28,13 +29,13 @@ describe "Action page" do
28
29
  end
29
30
 
30
31
  after :all do
31
- remove_doc
32
+ remove_structure
32
33
  remove_examples
33
34
  end
34
35
 
35
- context "when visit users_index.html page" do
36
+ context "when visit users/index.html page" do
36
37
  before do
37
- visit '/rapidoc/actions/users_index.html'
38
+ visit '/public/docs/actions/users/index.html'
38
39
  end
39
40
 
40
41
  context "when check action page" do
@@ -95,7 +96,7 @@ describe "Action page" do
95
96
 
96
97
  it "have table with one row for each parameter" do
97
98
  # +1 becouse rapidoc add empty row at the end
98
- page.should have_css( "table#table-params tr", :count => @params_info.size + 1 )
99
+ page.should have_css( "table#table-params tr", :count => @params_info.size + 2 )
99
100
  end
100
101
 
101
102
  it "have a row with parameter name" do
@@ -138,9 +139,9 @@ describe "Action page" do
138
139
  end
139
140
  end
140
141
 
141
- context "when visit users_create.html page" do
142
+ context "when visit users/create.html page" do
142
143
  before do
143
- visit '/rapidoc/actions/users_create.html'
144
+ visit '/public/docs/actions/users/create.html'
144
145
  end
145
146
 
146
147
  context "when check tab 'Params'" do
@@ -17,11 +17,11 @@ describe "Index page" do
17
17
  end
18
18
 
19
19
  before do
20
- visit '/rapidoc/index.html'
20
+ visit '/public/docs/index.html'
21
21
  end
22
22
 
23
23
  after :all do
24
- #remove_doc
24
+ remove_structure
25
25
  end
26
26
 
27
27
  context "when check global page" do
@@ -46,7 +46,7 @@ describe "Index page" do
46
46
  resource.actions_doc.each do |action|
47
47
  action.urls.each do |url|
48
48
  if action.has_controller_info
49
- page.should have_link( url, href: "actions/" + action.file + ".html" )
49
+ page.should have_link( url, href: "actions/" + action.file.gsub('_','/') + ".html" )
50
50
  else
51
51
  page.should have_text( url )
52
52
  end
@@ -6,15 +6,16 @@ describe ActionDoc do
6
6
 
7
7
  before :all do
8
8
  @json_info = { "user" => { "name" => "Check", "apellido" => "Me" } }
9
- response_file = examples_dir "users_create_response.json"
10
- answer_file = examples_dir "users_create_request.json"
9
+ response_file = examples_dir "users/create_response.json"
10
+ answer_file = examples_dir "users/create_request.json"
11
11
 
12
12
  reset_structure
13
+ create_folders_for_files([response_file, answer_file])
13
14
  File.open( response_file, 'w') { |file| file.write @json_info.to_json }
14
15
  File.open( answer_file, 'w') { |file| file.write @json_info.to_json }
15
16
 
16
- @info = {
17
- :resource=>"users",
17
+ @info = {
18
+ :resource=>"users",
18
19
  :action=>"create",
19
20
  :method=>"POST",
20
21
  :urls=>["/users(.:format)"]
@@ -26,6 +27,7 @@ describe ActionDoc do
26
27
 
27
28
  after :all do
28
29
  remove_examples
30
+ remove_structure
29
31
  end
30
32
 
31
33
  context "when initialize ActionDoc" do
@@ -63,7 +65,7 @@ describe ActionDoc do
63
65
  end
64
66
 
65
67
  it "set correct file" do
66
- @action_doc.file.should == @info[:resource].to_s + "_" + @info[:action].to_s
68
+ @action_doc.file.should == @info[:resource].to_s + "/" + @info[:action].to_s
67
69
  end
68
70
 
69
71
  it "set correct example_req" do
@@ -175,7 +177,7 @@ describe ActionDoc do
175
177
 
176
178
  context "when use config messages and descriptions" do
177
179
  before :all do
178
- File.open( config_file_path, 'w') do |file|
180
+ File.open( config_file_path, 'w') do |file|
179
181
  file.write "default_errors: true\n"
180
182
  file.write "errors:\n"
181
183
  file.write " required:\n message: \"m1\"\n description: \"d1\"\n"