mount_doc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +16 -0
- data/Guardfile +33 -0
- data/LICENSE +22 -0
- data/README.md +49 -0
- data/Rakefile +2 -0
- data/app/assets/stylesheets/mount_doc.css.scss +148 -0
- data/app/controllers/mount_doc/application_controller.rb +6 -0
- data/app/controllers/mount_doc/mount_doc_controller.rb +77 -0
- data/app/helpers/mount_doc/mount_doc_helper.rb +104 -0
- data/app/views/layouts/mount_doc.slim +55 -0
- data/app/views/mount_doc/mount_doc/action_doc.slim +57 -0
- data/app/views/mount_doc/mount_doc/controller_doc.slim +14 -0
- data/app/views/mount_doc/mount_doc/index.slim +1 -0
- data/app/views/mount_doc/mount_doc/not_found.slim +3 -0
- data/config/routes.rb +7 -0
- data/lib/mount_doc.rb +11 -0
- data/lib/mount_doc/config.rb +74 -0
- data/lib/mount_doc/document.rb +38 -0
- data/lib/mount_doc/rails.rb +6 -0
- data/lib/mount_doc/rails/engine.rb +10 -0
- data/lib/mount_doc/rails/generators.rb +5 -0
- data/lib/mount_doc/rails/generators/initialize_generator.rb +5 -0
- data/lib/mount_doc/rails/route_set.rb +19 -0
- data/lib/mount_doc/string_patch.rb +1 -0
- data/lib/mount_doc/version.rb +3 -0
- data/mount_doc.gemspec +23 -0
- data/spec/lib/mount_doc/config_spec.rb +73 -0
- data/spec/lib/mount_doc/document_spec.rb +17 -0
- data/spec/lib/mount_doc/rails/engine_spec.rb +7 -0
- data/spec/lib/mount_doc/rails/route_set_spec.rb +16 -0
- data/spec/lib/mount_doc/rails_spec.rb +16 -0
- data/spec/mock/rails_3.2.3/.gitignore +15 -0
- data/spec/mock/rails_3.2.3/Gemfile +40 -0
- data/spec/mock/rails_3.2.3/README.rdoc +261 -0
- data/spec/mock/rails_3.2.3/Rakefile +7 -0
- data/spec/mock/rails_3.2.3/app/assets/images/rails.png +0 -0
- data/spec/mock/rails_3.2.3/app/assets/javascripts/api/documents.js.coffee +3 -0
- data/spec/mock/rails_3.2.3/app/assets/javascripts/application.js +15 -0
- data/spec/mock/rails_3.2.3/app/assets/javascripts/users.js.coffee +3 -0
- data/spec/mock/rails_3.2.3/app/assets/stylesheets/api/documents.css.scss +3 -0
- data/spec/mock/rails_3.2.3/app/assets/stylesheets/application.css +13 -0
- data/spec/mock/rails_3.2.3/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/spec/mock/rails_3.2.3/app/assets/stylesheets/users.css.scss +3 -0
- data/spec/mock/rails_3.2.3/app/controllers/api/documents_controller.rb +121 -0
- data/spec/mock/rails_3.2.3/app/controllers/application_controller.rb +3 -0
- data/spec/mock/rails_3.2.3/app/controllers/users_controller.rb +83 -0
- data/spec/mock/rails_3.2.3/app/helpers/api/documents_helper.rb +2 -0
- data/spec/mock/rails_3.2.3/app/helpers/application_helper.rb +2 -0
- data/spec/mock/rails_3.2.3/app/helpers/users_helper.rb +2 -0
- data/spec/mock/rails_3.2.3/app/mailers/.gitkeep +0 -0
- data/spec/mock/rails_3.2.3/app/models/.gitkeep +0 -0
- data/spec/mock/rails_3.2.3/app/models/api.rb +5 -0
- data/spec/mock/rails_3.2.3/app/models/api/document.rb +3 -0
- data/spec/mock/rails_3.2.3/app/models/user.rb +3 -0
- data/spec/mock/rails_3.2.3/app/views/api/documents/_form.html.erb +17 -0
- data/spec/mock/rails_3.2.3/app/views/api/documents/edit.html.erb +6 -0
- data/spec/mock/rails_3.2.3/app/views/api/documents/index.html.erb +21 -0
- data/spec/mock/rails_3.2.3/app/views/api/documents/new.html.erb +5 -0
- data/spec/mock/rails_3.2.3/app/views/api/documents/show.html.erb +5 -0
- data/spec/mock/rails_3.2.3/app/views/layouts/application.html.erb +14 -0
- data/spec/mock/rails_3.2.3/app/views/users/_form.html.erb +17 -0
- data/spec/mock/rails_3.2.3/app/views/users/edit.html.erb +6 -0
- data/spec/mock/rails_3.2.3/app/views/users/index.html.erb +21 -0
- data/spec/mock/rails_3.2.3/app/views/users/new.html.erb +5 -0
- data/spec/mock/rails_3.2.3/app/views/users/show.html.erb +5 -0
- data/spec/mock/rails_3.2.3/config.ru +4 -0
- data/spec/mock/rails_3.2.3/config/application.rb +65 -0
- data/spec/mock/rails_3.2.3/config/boot.rb +6 -0
- data/spec/mock/rails_3.2.3/config/database.yml +25 -0
- data/spec/mock/rails_3.2.3/config/environment.rb +5 -0
- data/spec/mock/rails_3.2.3/config/environments/development.rb +38 -0
- data/spec/mock/rails_3.2.3/config/environments/production.rb +67 -0
- data/spec/mock/rails_3.2.3/config/environments/test.rb +37 -0
- data/spec/mock/rails_3.2.3/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/mock/rails_3.2.3/config/initializers/inflections.rb +15 -0
- data/spec/mock/rails_3.2.3/config/initializers/mime_types.rb +5 -0
- data/spec/mock/rails_3.2.3/config/initializers/secret_token.rb +7 -0
- data/spec/mock/rails_3.2.3/config/initializers/session_store.rb +8 -0
- data/spec/mock/rails_3.2.3/config/initializers/wrap_parameters.rb +14 -0
- data/spec/mock/rails_3.2.3/config/locales/en.yml +5 -0
- data/spec/mock/rails_3.2.3/config/routes.rb +63 -0
- data/spec/mock/rails_3.2.3/db/migrate/20120423193431_create_users.rb +8 -0
- data/spec/mock/rails_3.2.3/db/migrate/20120426181820_create_api_documents.rb +8 -0
- data/spec/mock/rails_3.2.3/db/schema.rb +21 -0
- data/spec/mock/rails_3.2.3/db/seeds.rb +7 -0
- data/spec/mock/rails_3.2.3/doc/README_FOR_APP +2 -0
- data/spec/mock/rails_3.2.3/doc//343/201/206/343/202/223/343/201/223/343/201/227/343/201/237/343/201/204.rdoc +3 -0
- data/spec/mock/rails_3.2.3/lib/assets/.gitkeep +0 -0
- data/spec/mock/rails_3.2.3/lib/tasks/.gitkeep +0 -0
- data/spec/mock/rails_3.2.3/log/.gitkeep +0 -0
- data/spec/mock/rails_3.2.3/public/404.html +26 -0
- data/spec/mock/rails_3.2.3/public/422.html +26 -0
- data/spec/mock/rails_3.2.3/public/500.html +25 -0
- data/spec/mock/rails_3.2.3/public/favicon.ico +0 -0
- data/spec/mock/rails_3.2.3/public/index.html +241 -0
- data/spec/mock/rails_3.2.3/public/robots.txt +5 -0
- data/spec/mock/rails_3.2.3/script/rails +6 -0
- data/spec/mock/rails_3.2.3/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/mock/rails_3.2.3/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/mock/rails_3.2.3/vendor/plugins/.gitkeep +0 -0
- data/spec/requests/mount_doc_request_spec.rb +34 -0
- data/spec/requests/users_request_spec.rb +10 -0
- data/spec/spec_helper.rb +34 -0
- metadata +313 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
doctype 5
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta charset="UTF-8"
|
5
|
+
title
|
6
|
+
= @page_title
|
7
|
+
| - † MountDoc †
|
8
|
+
= stylesheet_link_tag :mount_doc
|
9
|
+
body
|
10
|
+
|
11
|
+
article#main
|
12
|
+
= yield.force_encoding('utf-8')
|
13
|
+
|
14
|
+
aside#side-index
|
15
|
+
|
16
|
+
- if mount_doc_config.visible_components.include?(:files)
|
17
|
+
div#files-index
|
18
|
+
h6 Files
|
19
|
+
|
20
|
+
ul
|
21
|
+
- for file in files
|
22
|
+
li
|
23
|
+
a(href="#{url_for(:controller => 'mount_doc', :action => 'file_doc', :id => file)}")
|
24
|
+
= file
|
25
|
+
|
26
|
+
- if mount_doc_config.visible_components.include?(:urls)
|
27
|
+
div#urls-index
|
28
|
+
h6 URLs
|
29
|
+
|
30
|
+
ul
|
31
|
+
- for route in routes
|
32
|
+
li
|
33
|
+
a(href="#{url_for(:controller => 'mount_doc', :action => 'action_doc', :ctrl_id => route[:controller].gsub('/', '::'), :id => route[:action])}")
|
34
|
+
span.method= route[:method]
|
35
|
+
= route[:path]
|
36
|
+
|
37
|
+
- if mount_doc_config.visible_components.include?(:controllers)
|
38
|
+
div#controllers-index
|
39
|
+
h6 Controllers
|
40
|
+
|
41
|
+
ul
|
42
|
+
- for controller in controllers
|
43
|
+
li
|
44
|
+
a(href="#{url_for(:controller => 'mount_doc', :action => 'controller_doc', :id => controller.gsub('/', '::'))}")
|
45
|
+
= controller.camelize
|
46
|
+
|
47
|
+
- if mount_doc_config.visible_components.include?(:models)
|
48
|
+
div#models-index
|
49
|
+
h6 Models
|
50
|
+
|
51
|
+
ul
|
52
|
+
- for model in models
|
53
|
+
li
|
54
|
+
a(href="#{url_for(:model => 'mount_doc', :action => 'model_doc', :id => model.gsub('/', '::'))}")
|
55
|
+
= model.camelize
|
@@ -0,0 +1,57 @@
|
|
1
|
+
|
2
|
+
- if @document.tags('deprecated').size > 0
|
3
|
+
p.deprecated DEPRECATED: #{@document.tags('deprecated').first.text}
|
4
|
+
|
5
|
+
h1
|
6
|
+
= @controller_name.gsub('::', '/').camelize + '#' +@action_name
|
7
|
+
- if @document.tags('version').size > 0
|
8
|
+
| (v#{@document.tags('version').first.text})
|
9
|
+
|
10
|
+
ul.urls
|
11
|
+
- for route in routes_for(@controller_name.gsub('::', '/'), @action_name)
|
12
|
+
li
|
13
|
+
span.method= route[:method]
|
14
|
+
= route[:path]
|
15
|
+
|
16
|
+
== markup @document.docstring.to_s
|
17
|
+
|
18
|
+
- if @document.tags('param').size > 0
|
19
|
+
h2 Params
|
20
|
+
|
21
|
+
ul.params
|
22
|
+
- for param in @document.tags('param')
|
23
|
+
li
|
24
|
+
| ( #{param.types.map(&:downcase).join(', ')} ) <code><b>#{param.name}</b></code> — <small>#{param.text}</small>
|
25
|
+
- if (options = @document.tags('option').select{|opt| opt.name == param.name }).size > 0
|
26
|
+
ul
|
27
|
+
- for option in options
|
28
|
+
li ( #{option.pair.types.map(&:downcase).join(', ')} ) <code><b>#{option.pair.name}</b></code> — <small>#{option.pair.text}</small>
|
29
|
+
|
30
|
+
- if @document.tags('example').size > 0
|
31
|
+
h2 Example
|
32
|
+
|
33
|
+
- for example in @document.tags('example')
|
34
|
+
h3= example.name
|
35
|
+
pre
|
36
|
+
code= example.text
|
37
|
+
|
38
|
+
- if @document.tags('response').size > 0
|
39
|
+
h2 Response
|
40
|
+
|
41
|
+
- for response in @document.tags('response')
|
42
|
+
pre
|
43
|
+
span.type= response.name.to_s.upcase
|
44
|
+
code== syntaxhighlight response.name, response.text
|
45
|
+
|
46
|
+
- if @document.tags('todo').size > 0
|
47
|
+
h2 ToDo
|
48
|
+
|
49
|
+
- for todo in @document.tags('todo')
|
50
|
+
== markup todo.text
|
51
|
+
|
52
|
+
h2 Code
|
53
|
+
|
54
|
+
p
|
55
|
+
code= @document.file.sub(Rails.root.to_s, '')
|
56
|
+
pre
|
57
|
+
code== syntaxhighlight :ruby, @document.source
|
@@ -0,0 +1,14 @@
|
|
1
|
+
h1= @controller_name.gsub('::', '/').camelize
|
2
|
+
|
3
|
+
== markup @document.docstring.to_s
|
4
|
+
|
5
|
+
- for action in actions(@document)
|
6
|
+
h2
|
7
|
+
a href="#{url_for(controller: 'mount_doc', action: 'action_doc', ctrl_id: @controller_name, id: action[:method].name)}"
|
8
|
+
= action[:method].name
|
9
|
+
ul.urls
|
10
|
+
- for route in action[:routes]
|
11
|
+
li
|
12
|
+
span.method= route[:method]
|
13
|
+
= route[:path]
|
14
|
+
== markup action[:method].docstring.summary.sub(/\.\Z/, '')
|
@@ -0,0 +1 @@
|
|
1
|
+
p paragraph
|
data/config/routes.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
MountDoc::Engine.routes.draw do
|
2
|
+
match 'controllers/:id' => 'mount_doc#controller_doc'
|
3
|
+
match 'controllers/:ctrl_id/actions/:id' => 'mount_doc#action_doc'
|
4
|
+
match 'models/:id' => 'mount_doc#model_doc'
|
5
|
+
match 'files/*id' => 'mount_doc#file_doc'
|
6
|
+
match '/' => 'mount_doc#index', :as => 'mount_doc_root'
|
7
|
+
end
|
data/lib/mount_doc.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module MountDoc
|
4
|
+
autoload :VERSION, "mount_doc/version"
|
5
|
+
autoload :Config, "mount_doc/config"
|
6
|
+
autoload :Document, "mount_doc/document"
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'mount_doc/string_patch'
|
10
|
+
require 'mount_doc/rails'
|
11
|
+
require 'mount_doc/rails/generators'
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'mount_doc'
|
2
|
+
|
3
|
+
module MountDoc::Config
|
4
|
+
mattr_reader :auto_mount
|
5
|
+
def auto_mount=(bool)
|
6
|
+
@@auto_mount = !!bool
|
7
|
+
end
|
8
|
+
module_function :auto_mount=
|
9
|
+
def auto_mount?; @@auto_mount; end
|
10
|
+
module_function :auto_mount?
|
11
|
+
mattr_reader :auto_mount_path
|
12
|
+
def auto_mount_path=(path)
|
13
|
+
@@auto_mount_path = path.to_s
|
14
|
+
end
|
15
|
+
module_function :auto_mount_path=
|
16
|
+
|
17
|
+
mattr_reader :visible_private_methods
|
18
|
+
def visible_private_methods=(visible)
|
19
|
+
@@visible_private_methods = !!visible
|
20
|
+
end
|
21
|
+
module_function :visible_private_methods=
|
22
|
+
def visible_private_methods?; @@visible_private_methods; end
|
23
|
+
module_function :visible_private_methods?
|
24
|
+
|
25
|
+
mattr_reader :visible_protected_methods
|
26
|
+
def visible_protected_methods=(visible)
|
27
|
+
@@visible_protected_methods = !!visible
|
28
|
+
end
|
29
|
+
module_function :visible_protected_methods=
|
30
|
+
def visible_protected_methods?; @@visible_protected_methods; end
|
31
|
+
module_function :visible_protected_methods?
|
32
|
+
|
33
|
+
Components = [
|
34
|
+
:files,
|
35
|
+
:urls,
|
36
|
+
:controllers
|
37
|
+
]
|
38
|
+
mattr_reader :visible_components
|
39
|
+
def visible_components=(components)
|
40
|
+
components.select!{|component| Components.include?(component) }
|
41
|
+
@@visible_components = components
|
42
|
+
end
|
43
|
+
module_function :visible_components=
|
44
|
+
|
45
|
+
mattr_reader :doc_file_path
|
46
|
+
def doc_file_path=(path)
|
47
|
+
@@doc_file_path = path.to_s
|
48
|
+
end
|
49
|
+
module_function :doc_file_path=
|
50
|
+
|
51
|
+
mattr_reader :markup
|
52
|
+
def markup=(path)
|
53
|
+
@@markup = path.to_s
|
54
|
+
end
|
55
|
+
module_function :markup=
|
56
|
+
|
57
|
+
DefaultSettings = {
|
58
|
+
auto_mount: false,
|
59
|
+
auto_mount_path: '/doc',
|
60
|
+
visible_private_methods: false,
|
61
|
+
visible_protected_methods: false,
|
62
|
+
visible_components: Components,
|
63
|
+
doc_file_path: 'doc',
|
64
|
+
markup: :rdoc
|
65
|
+
}
|
66
|
+
def defaults!
|
67
|
+
DefaultSettings.each_pair do | name, val |
|
68
|
+
self.send("#{name}=", val)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
module_function :defaults!
|
72
|
+
|
73
|
+
self.defaults!
|
74
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'mount_doc'
|
2
|
+
require 'yard'
|
3
|
+
|
4
|
+
YARD::Tags::Library.define_tag "Response", :response, :with_title_and_text
|
5
|
+
|
6
|
+
class MountDoc::Document
|
7
|
+
attr_reader :type, :name, :doc_object
|
8
|
+
|
9
|
+
def initialize(type, name)
|
10
|
+
@type = type
|
11
|
+
@name = name
|
12
|
+
|
13
|
+
load_file
|
14
|
+
end
|
15
|
+
|
16
|
+
def load_file(type = @type, name = @name)
|
17
|
+
case type
|
18
|
+
when :controller
|
19
|
+
load_controller(name)
|
20
|
+
when :model
|
21
|
+
load_model(name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_controller(name)
|
26
|
+
controller_name = name.gsub('::', '/').camelize + 'Controller'
|
27
|
+
file_path = File.join(::Rails.root, 'app/controllers', "#{controller_name.underscore}.rb")
|
28
|
+
YARD.parse(file_path)
|
29
|
+
@doc_object = P(controller_name)
|
30
|
+
end
|
31
|
+
|
32
|
+
def load_model(name)
|
33
|
+
model_name = name.gsub('::', '/').camelize
|
34
|
+
file_path = File.join(::Rails.root, 'app/models', "#{model_name.underscore}.rb")
|
35
|
+
YARD.parse(file_path)
|
36
|
+
@doc_object = P(model_name)
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'mount_doc'
|
2
|
+
require 'action_dispatch/routing/route_set'
|
3
|
+
|
4
|
+
class ActionDispatch::Routing::RouteSet
|
5
|
+
def finalize_with_mount_doc!
|
6
|
+
result = finalize_without_mount_doc!
|
7
|
+
|
8
|
+
begin
|
9
|
+
self.eval_block(lambda{
|
10
|
+
mount MountDoc::Engine => MountDoc::Config.auto_mount_path
|
11
|
+
}) if MountDoc::Config.auto_mount? && self.named_routes.get(:mount_doc_rails_engine).nil?
|
12
|
+
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
result
|
17
|
+
end
|
18
|
+
alias_method_chain :finalize!, :mount_doc
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'mount_doc'
|
data/mount_doc.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/mount_doc/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Sho Kusano"]
|
6
|
+
gem.email = ["rosylilly@aduca.org"]
|
7
|
+
gem.description = %q{Supporting Build APIs on Rails}
|
8
|
+
gem.summary = %q{Railsで書かれたアクションにコメントを書くと、動的にドキュメントを生成し、その結果をRailsアプリにマウントする}
|
9
|
+
gem.homepage = "https://github.com/rosylilly/mount_doc"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "mount_doc"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = MountDoc::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency('rails', '~> 3.2')
|
19
|
+
gem.add_dependency('github-markup', '~> 0.7')
|
20
|
+
gem.add_dependency('slim', '~> 1.2')
|
21
|
+
gem.add_dependency('yard', '~> 0.8')
|
22
|
+
gem.add_dependency('coderay', '~> 1.0')
|
23
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MountDoc::Config do
|
4
|
+
describe :auto_mount do
|
5
|
+
subject{ MountDoc::Config.auto_mount? }
|
6
|
+
it("default: false"){ should be_false }
|
7
|
+
|
8
|
+
it("writable boolean"){
|
9
|
+
MountDoc::Config.auto_mount = 1
|
10
|
+
should be_true
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
describe :auto_mount_path do
|
15
|
+
subject { MountDoc::Config.auto_mount_path }
|
16
|
+
|
17
|
+
it("default: /doc"){ should == '/doc' }
|
18
|
+
|
19
|
+
it('writable string'){
|
20
|
+
MountDoc::Config.auto_mount_path = 1
|
21
|
+
should == '1'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
describe :visible_private_methods do
|
26
|
+
subject{ MountDoc::Config.visible_private_methods? }
|
27
|
+
|
28
|
+
it("default: false"){ should be_false }
|
29
|
+
|
30
|
+
it("writable boolean"){
|
31
|
+
MountDoc::Config.visible_private_methods = 1
|
32
|
+
should be_true
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
describe :visible_protected_methods do
|
37
|
+
subject{ MountDoc::Config.visible_protected_methods? }
|
38
|
+
|
39
|
+
it("default: false"){ should be_false }
|
40
|
+
|
41
|
+
it("writable boolean"){
|
42
|
+
MountDoc::Config.visible_protected_methods = 1
|
43
|
+
should be_true
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
describe :visible_components do
|
48
|
+
subject{ MountDoc::Config.visible_components }
|
49
|
+
|
50
|
+
it("default: MountDoc::Config::Components"){ should == MountDoc::Config::Components }
|
51
|
+
|
52
|
+
it("writable MountDoc::Config::Components"){
|
53
|
+
MountDoc::Config.visible_components = [:urls, :invalid, :controllers]
|
54
|
+
should == [:urls, :controllers]
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
describe :doc_file_path do
|
59
|
+
subject{ MountDoc::Config.doc_file_path }
|
60
|
+
|
61
|
+
it("default: 'doc'"){ should == 'doc' }
|
62
|
+
end
|
63
|
+
|
64
|
+
describe :defaults! do
|
65
|
+
subject{ MountDoc::Config }
|
66
|
+
|
67
|
+
it("set default"){
|
68
|
+
subject.visible_protected_methods = true
|
69
|
+
subject.defaults!
|
70
|
+
subject.visible_protected_methods.should be_false
|
71
|
+
}
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MountDoc::Document do
|
4
|
+
describe "initialize from file" do
|
5
|
+
it "controller" do
|
6
|
+
doc = MountDoc::Document.new(:controller, "api::documents")
|
7
|
+
|
8
|
+
doc.doc_object.name.should == :DocumentsController
|
9
|
+
end
|
10
|
+
|
11
|
+
it "model" do
|
12
|
+
doc = MountDoc::Document.new(:model, "api::document")
|
13
|
+
|
14
|
+
doc.doc_object.name.should == :Document
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|