danger-toc 0.2.0 → 0.3.0

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +101 -15
  4. data/lib/toc/config.rb +57 -32
  5. data/lib/toc/constructors/kramdown_constructor.rb +5 -6
  6. data/lib/toc/constructors.rb +0 -4
  7. data/lib/toc/extractor.rb +2 -1
  8. data/lib/toc/gem_version.rb +1 -1
  9. data/lib/toc/markdown_file.rb +62 -22
  10. data/lib/toc/plugin.rb +53 -33
  11. metadata +43 -61
  12. data/.gitignore +0 -11
  13. data/.rspec +0 -2
  14. data/.rubocop.yml +0 -14
  15. data/.rubocop_todo.yml +0 -81
  16. data/.travis.yml +0 -14
  17. data/CONTRIBUTING.md +0 -125
  18. data/Dangerfile +0 -4
  19. data/Gemfile +0 -16
  20. data/Guardfile +0 -19
  21. data/RELEASING.md +0 -67
  22. data/Rakefile +0 -23
  23. data/danger-toc.gemspec +0 -23
  24. data/images/toc-missing.png +0 -0
  25. data/spec/config_spec.rb +0 -60
  26. data/spec/constructors_spec.rb +0 -23
  27. data/spec/fixtures/markdown_file/one_section.md +0 -5
  28. data/spec/fixtures/markdown_file/one_section_with_custom_toc.md +0 -11
  29. data/spec/fixtures/markdown_file/one_section_with_invalid_toc.md +0 -11
  30. data/spec/fixtures/markdown_file/one_section_with_toc.md +0 -11
  31. data/spec/fixtures/markdown_file/one_section_with_toc_level.md +0 -11
  32. data/spec/fixtures/markdown_file/one_section_with_underscore_in_name.md +0 -11
  33. data/spec/fixtures/markdown_file/with_quoted_example.md +0 -26
  34. data/spec/markdown_file/danger_toc_readme_spec.rb +0 -19
  35. data/spec/markdown_file/one_section_spec.rb +0 -28
  36. data/spec/markdown_file/one_section_with_toc_level_spec.rb +0 -28
  37. data/spec/markdown_file/one_section_with_toc_spec.rb +0 -28
  38. data/spec/markdown_file/with_quoted_example_spec.rb +0 -33
  39. data/spec/markdown_file/with_underscore_in_section_name_spec.rb +0 -32
  40. data/spec/spec_helper.rb +0 -38
  41. data/spec/toc_spec.rb +0 -134
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-toc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - dblock
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-28 00:00:00.000000000 Z
11
+ date: 2026-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: danger-plugin-api
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: diff-lcs
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: kramdown
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -39,19 +67,19 @@ dependencies:
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
- name: danger-plugin-api
70
+ name: kramdown-parser-gfm
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - "~>"
73
+ - - ">="
46
74
  - !ruby/object:Gem::Version
47
- version: '1.0'
75
+ version: '0'
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - "~>"
80
+ - - ">="
53
81
  - !ruby/object:Gem::Version
54
- version: '1.0'
82
+ version: '0'
55
83
  description: A danger.systems plugin for your markdown TOC.
56
84
  email:
57
85
  - dblock@dblock.org
@@ -59,22 +87,9 @@ executables: []
59
87
  extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
62
- - ".gitignore"
63
- - ".rspec"
64
- - ".rubocop.yml"
65
- - ".rubocop_todo.yml"
66
- - ".travis.yml"
67
90
  - CHANGELOG.md
68
- - CONTRIBUTING.md
69
- - Dangerfile
70
- - Gemfile
71
- - Guardfile
72
91
  - LICENSE.txt
73
92
  - README.md
74
- - RELEASING.md
75
- - Rakefile
76
- - danger-toc.gemspec
77
- - images/toc-missing.png
78
93
  - lib/danger_plugin.rb
79
94
  - lib/danger_toc.rb
80
95
  - lib/toc/config.rb
@@ -85,28 +100,12 @@ files:
85
100
  - lib/toc/gem_version.rb
86
101
  - lib/toc/markdown_file.rb
87
102
  - lib/toc/plugin.rb
88
- - spec/config_spec.rb
89
- - spec/constructors_spec.rb
90
- - spec/fixtures/markdown_file/one_section.md
91
- - spec/fixtures/markdown_file/one_section_with_custom_toc.md
92
- - spec/fixtures/markdown_file/one_section_with_invalid_toc.md
93
- - spec/fixtures/markdown_file/one_section_with_toc.md
94
- - spec/fixtures/markdown_file/one_section_with_toc_level.md
95
- - spec/fixtures/markdown_file/one_section_with_underscore_in_name.md
96
- - spec/fixtures/markdown_file/with_quoted_example.md
97
- - spec/markdown_file/danger_toc_readme_spec.rb
98
- - spec/markdown_file/one_section_spec.rb
99
- - spec/markdown_file/one_section_with_toc_level_spec.rb
100
- - spec/markdown_file/one_section_with_toc_spec.rb
101
- - spec/markdown_file/with_quoted_example_spec.rb
102
- - spec/markdown_file/with_underscore_in_section_name_spec.rb
103
- - spec/spec_helper.rb
104
- - spec/toc_spec.rb
105
103
  homepage: https://github.com/dblock/danger-toc
106
104
  licenses:
107
105
  - MIT
108
- metadata: {}
109
- post_install_message:
106
+ metadata:
107
+ rubygems_mfa_required: 'true'
108
+ post_install_message:
110
109
  rdoc_options: []
111
110
  require_paths:
112
111
  - lib
@@ -114,32 +113,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
113
  requirements:
115
114
  - - ">="
116
115
  - !ruby/object:Gem::Version
117
- version: '0'
116
+ version: '3.1'
118
117
  required_rubygems_version: !ruby/object:Gem::Requirement
119
118
  requirements:
120
119
  - - ">="
121
120
  - !ruby/object:Gem::Version
122
121
  version: '0'
123
122
  requirements: []
124
- rubygems_version: 3.0.3
125
- signing_key:
123
+ rubygems_version: 3.5.16
124
+ signing_key:
126
125
  specification_version: 4
127
126
  summary: A danger.systems plugin for your markdown TOC.
128
- test_files:
129
- - spec/config_spec.rb
130
- - spec/constructors_spec.rb
131
- - spec/fixtures/markdown_file/one_section.md
132
- - spec/fixtures/markdown_file/one_section_with_custom_toc.md
133
- - spec/fixtures/markdown_file/one_section_with_invalid_toc.md
134
- - spec/fixtures/markdown_file/one_section_with_toc.md
135
- - spec/fixtures/markdown_file/one_section_with_toc_level.md
136
- - spec/fixtures/markdown_file/one_section_with_underscore_in_name.md
137
- - spec/fixtures/markdown_file/with_quoted_example.md
138
- - spec/markdown_file/danger_toc_readme_spec.rb
139
- - spec/markdown_file/one_section_spec.rb
140
- - spec/markdown_file/one_section_with_toc_level_spec.rb
141
- - spec/markdown_file/one_section_with_toc_spec.rb
142
- - spec/markdown_file/with_quoted_example_spec.rb
143
- - spec/markdown_file/with_underscore_in_section_name_spec.rb
144
- - spec/spec_helper.rb
145
- - spec/toc_spec.rb
127
+ test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- .DS_Store
2
- pkg
3
- .idea/
4
- Gemfile.lock
5
- .yardoc
6
-
7
- # ignore the Ruby Version manager
8
- .rvmrc
9
- .ruby-version
10
- .ruby-gemset
11
- .rbenv
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --format=documentation
data/.rubocop.yml DELETED
@@ -1,14 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - vendor/**/*
4
-
5
- Metrics/BlockLength:
6
- Enabled: fale
7
-
8
- Metrics/LineLength:
9
- Enabled: fale
10
-
11
- Style/ModuleFunction:
12
- Enabled: false
13
-
14
- inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml DELETED
@@ -1,81 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2019-07-28 16:26:13 -0400 using RuboCop version 0.58.2.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 3
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: EnforcedStyle.
12
- # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
13
- Layout/IndentHeredoc:
14
- Exclude:
15
- - 'lib/toc/plugin.rb'
16
- - 'spec/toc_spec.rb'
17
-
18
- # Offense count: 4
19
- Metrics/AbcSize:
20
- Max: 19
21
-
22
- # Offense count: 8
23
- # Configuration parameters: CountComments, ExcludedMethods.
24
- # ExcludedMethods: refine
25
- Metrics/BlockLength:
26
- Max: 109
27
-
28
- # Offense count: 3
29
- # Configuration parameters: CountComments.
30
- Metrics/MethodLength:
31
- Max: 21
32
-
33
- # Offense count: 2
34
- # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
35
- # NamePrefix: is_, has_, have_
36
- # NamePrefixBlacklist: is_, has_, have_
37
- # NameWhitelist: is_a?
38
- # MethodDefinitionMacros: define_method, define_singleton_method
39
- Naming/PredicateName:
40
- Exclude:
41
- - 'spec/**/*'
42
- - 'lib/toc/markdown_file.rb'
43
- - 'lib/toc/plugin.rb'
44
-
45
- # Offense count: 3
46
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
47
- # AllowedNames: io, id, to, by, on, in, at, ip
48
- Naming/UncommunicativeMethodParamName:
49
- Exclude:
50
- - 'lib/toc/constructors/kramdown_constructor.rb'
51
- - 'lib/toc/extractor.rb'
52
-
53
- # Offense count: 8
54
- Style/Documentation:
55
- Exclude:
56
- - 'spec/**/*'
57
- - 'test/**/*'
58
- - 'lib/toc/config.rb'
59
- - 'lib/toc/constructors.rb'
60
- - 'lib/toc/constructors/github_constructor.rb'
61
- - 'lib/toc/constructors/kramdown_constructor.rb'
62
- - 'lib/toc/extractor.rb'
63
- - 'lib/toc/markdown_file.rb'
64
- - 'lib/toc/plugin.rb'
65
-
66
- # Offense count: 3
67
- Style/DoubleNegation:
68
- Exclude:
69
- - 'lib/toc/markdown_file.rb'
70
-
71
- # Offense count: 2
72
- # Configuration parameters: MinBodyLength.
73
- Style/GuardClause:
74
- Exclude:
75
- - 'lib/toc/markdown_file.rb'
76
-
77
- # Offense count: 26
78
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
79
- # URISchemes: http, https
80
- Metrics/LineLength:
81
- Max: 123
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
-
3
- cache:
4
- directories:
5
- - bundle
6
-
7
- rvm:
8
- - 2.4.1
9
-
10
- before_script:
11
- - bundle exec danger
12
-
13
- script:
14
- - bundle exec rake spec
data/CONTRIBUTING.md DELETED
@@ -1,125 +0,0 @@
1
- # Contributing to Danger-Toc
2
-
3
- This project is work of [many contributors](https://github.com/dblock/danger-toc/graphs/contributors).
4
-
5
- You're encouraged to submit [pull requests](https://github.com/dblock/danger-toc/pulls), [propose features and discuss issues](https://github.com/dblock/danger-toc/issues).
6
-
7
- In the examples below, substitute your Github username for `contributor` in URLs.
8
-
9
- ### Fork the Project
10
-
11
- Fork the [project on Github](https://github.com/dblock/danger-toc) and check out your copy.
12
-
13
- ```
14
- git clone https://github.com/contributor/danger-toc.git
15
- cd danger-toc
16
- git remote add upstream https://github.com/dblock/danger-toc.git
17
- ```
18
-
19
- ### Bundle Install and Test
20
-
21
- Ensure that you can build the project and run tests.
22
-
23
- ```
24
- bundle install
25
- bundle exec rake
26
- ```
27
-
28
- ## Contribute Code
29
-
30
- ### Create a Topic Branch
31
-
32
- Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
33
-
34
- ```
35
- git checkout master
36
- git pull upstream master
37
- git checkout -b my-feature-branch
38
- ```
39
-
40
- ### Write Tests
41
-
42
- Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to [spec](spec).
43
-
44
- We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
45
-
46
- ### Write Code
47
-
48
- Implement your feature or bug fix.
49
-
50
- Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
51
-
52
- Make sure that `bundle exec rake` completes without errors.
53
-
54
- ### Write Documentation
55
-
56
- Document any external behavior in the [README](README.md).
57
-
58
- ### Update Toc
59
-
60
- Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Don't remove *Your contribution here*.
61
-
62
- Make it look like every other line, including a link to the issue being fixed, your name and link to your Github account.
63
-
64
- ### Commit Changes
65
-
66
- Make sure git knows your name and email address:
67
-
68
- ```
69
- git config --global user.name "Your Name"
70
- git config --global user.email "contributor@example.com"
71
- ```
72
-
73
- Writing good commit logs is important. A commit log should describe what changed and why.
74
-
75
- ```
76
- git add ...
77
- git commit
78
- ```
79
-
80
- ### Push
81
-
82
- ```
83
- git push origin my-feature-branch
84
- ```
85
-
86
- ### Make a Pull Request
87
-
88
- Go to https://github.com/contributor/danger-toc and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
89
-
90
- ### Update CHANGELOG Again
91
-
92
- Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
93
-
94
- ```
95
- * [#123](https://github.com/dblock/danger-toc/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
96
- ```
97
-
98
- Amend your previous commit and force push the changes.
99
-
100
- ```
101
- git commit --amend
102
- git push origin my-feature-branch -f
103
- ```
104
-
105
- ### Rebase
106
-
107
- If you've been working on a change for a while, rebase with upstream/master.
108
-
109
- ```
110
- git fetch upstream
111
- git rebase upstream/master
112
- git push origin my-feature-branch -f
113
- ```
114
-
115
- ### Check on Your Pull Request
116
-
117
- Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
118
-
119
- ### Be Patient
120
-
121
- It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
122
-
123
- ## Thank You
124
-
125
- Please do know that we really appreciate and value your time and work. We love you, really.
data/Dangerfile DELETED
@@ -1,4 +0,0 @@
1
- # danger.systems
2
-
3
- changelog.check!
4
- toc.check!
data/Gemfile DELETED
@@ -1,16 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development, :test do
6
- gem 'bundler'
7
- gem 'danger-changelog', '~> 0.6.0'
8
- gem 'guard', '~> 2.14'
9
- gem 'guard-rspec', '~> 4.7'
10
- gem 'listen'
11
- gem 'pry'
12
- gem 'rake', '~> 10.0'
13
- gem 'rspec', '~> 3.4'
14
- gem 'rubocop', '0.58.2'
15
- gem 'yard'
16
- end
data/Guardfile DELETED
@@ -1,19 +0,0 @@
1
- # A guardfile for making Danger Plugins
2
- # For more info see https://github.com/guard/guard#readme
3
-
4
- # To run, use `bundle exec guard`.
5
-
6
- guard :rspec, cmd: 'bundle exec rspec' do
7
- require 'guard/rspec/dsl'
8
- dsl = Guard::RSpec::Dsl.new(self)
9
-
10
- # RSpec files
11
- rspec = dsl.rspec
12
- watch(rspec.spec_helper) { rspec.spec_dir }
13
- watch(rspec.spec_support) { rspec.spec_dir }
14
- watch(rspec.spec_files)
15
-
16
- # Ruby files
17
- ruby = dsl.ruby
18
- dsl.watch_spec_files_for(ruby.lib_files)
19
- end
data/RELEASING.md DELETED
@@ -1,67 +0,0 @@
1
- # Releasing Danger-Toc
2
-
3
- There're no hard rules about when to release danger-toc. Release bug fixes frequently, features not so frequently and breaking API changes rarely.
4
-
5
- ### Release
6
-
7
- Install bundle, run tests, check that all tests succeed locally.
8
-
9
- ```
10
- bundle install
11
- rake
12
- ```
13
-
14
- Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/danger-toc) for all supported platforms.
15
-
16
- Increment the version, modify [lib/toc/gem_version.rb](lib/toc/gem_version.rb).
17
-
18
- Following the [Semantic Versioning](http://semver.org/):
19
- * Increment the third number if the release has bug fixes and/or very minor features with backward compatibility, only (eg. change `0.2.1` to `0.2.2`).
20
- * Increment the second number if the release contains major features or breaking API changes (eg. change `0.2.1` to `0.3.0`).
21
-
22
- Create a new version and mark it as Next in [CHANGELOG.md](CHANGELOG.md).
23
-
24
- ```
25
- ### 0.2.2 (12/03/2016)
26
- ```
27
-
28
- Remove the line with "* Your contribution here.", since there will be no more contributions to this release.
29
-
30
- Commit your changes.
31
-
32
- ```
33
- git add CHANGELOG.md lib/toc/gem_version.rb
34
- git commit -m "Preparing for release, 0.2.2."
35
- git push origin master
36
- ```
37
-
38
- Release.
39
-
40
- ```
41
- $ rake release
42
-
43
- danger-toc 0.2.2 built to pkg/danger-toc-0.2.2.gem.
44
- Tagged v0.2.2.
45
- Pushed git commits and tags.
46
- Pushed danger-toc 0.2.2 to rubygems.org.
47
- ```
48
-
49
- ### Prepare for the Next Version
50
-
51
- Add the next release to [CHANGELOG.md](CHANGELOG.md).
52
-
53
- ```
54
- ### 0.2.3 (Next)
55
-
56
- * Your contribution here.
57
- ```
58
-
59
- Increment the third version number in [lib/toc/gem_version.rb](lib/toc/gem_version.rb).
60
-
61
- Commit your changes.
62
-
63
- ```
64
- git add CHANGELOG.md lib/toc/gem_version.rb
65
- git commit -m "Preparing for next development iteration, 0.2.3."
66
- git push origin master
67
- ```
data/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'rubocop/rake_task'
4
-
5
- RSpec::Core::RakeTask.new(:specs)
6
-
7
- task default: %i[rubocop specs]
8
-
9
- task :spec do
10
- Rake::Task['specs'].invoke
11
- Rake::Task['rubocop'].invoke
12
- Rake::Task['spec_docs'].invoke
13
- end
14
-
15
- desc 'Run RuboCop on the lib/specs directory'
16
- RuboCop::RakeTask.new(:rubocop) do |task|
17
- task.patterns = ['lib/**/*.rb', 'spec/**/*.rb']
18
- end
19
-
20
- desc 'Ensure that the plugin passes `danger plugins lint`'
21
- task :spec_docs do
22
- sh 'bundle exec danger plugins lint'
23
- end
data/danger-toc.gemspec DELETED
@@ -1,23 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'toc/gem_version.rb'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'danger-toc'
7
- spec.version = Toc::VERSION
8
- spec.authors = ['dblock']
9
- spec.email = ['dblock@dblock.org']
10
- spec.description = 'A danger.systems plugin for your markdown TOC.'
11
- spec.summary = 'A danger.systems plugin for your markdown TOC.'
12
- spec.homepage = 'https://github.com/dblock/danger-toc'
13
- spec.license = 'MIT'
14
-
15
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ['lib']
19
-
20
- spec.add_dependency 'activesupport'
21
- spec.add_dependency 'kramdown'
22
- spec.add_runtime_dependency 'danger-plugin-api', '~> 1.0'
23
- end
Binary file
data/spec/config_spec.rb DELETED
@@ -1,60 +0,0 @@
1
- require File.expand_path('spec_helper', __dir__)
2
-
3
- describe Danger::Toc::Config do
4
- after(:each) do
5
- described_class.reset
6
- end
7
-
8
- describe 'configure' do
9
- describe 'files' do
10
- context 'default' do
11
- it 'assumes README.md' do
12
- expect(Danger::Toc.config.files).to eq ['README.md']
13
- end
14
- end
15
- context 'custom value' do
16
- before do
17
- Danger::Toc.config.files = ['README.md', 'SOMETHING.md']
18
- end
19
-
20
- it 'is set' do
21
- expect(Danger::Toc.config.files).to eq ['README.md', 'SOMETHING.md']
22
- end
23
- end
24
- end
25
- describe 'header' do
26
- context 'default' do
27
- it 'assumes Table of Contents' do
28
- expect(Danger::Toc.config.header).to eq 'Table of Contents'
29
- end
30
- end
31
- context 'custom value' do
32
- before do
33
- Danger::Toc.config.header = 'Custom TOC'
34
- end
35
-
36
- it 'is set' do
37
- expect(Danger::Toc.config.header).to eq 'Custom TOC'
38
- end
39
- end
40
- end
41
-
42
- describe 'format' do
43
- context 'default' do
44
- it 'assumes github' do
45
- expect(Danger::Toc.config.format).to eq(:github)
46
- end
47
- end
48
-
49
- context 'custom value' do
50
- before do
51
- Danger::Toc.config.format = :kramdown
52
- end
53
-
54
- it 'is set' do
55
- expect(Danger::Toc.config.format).to eq(:kramdown)
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,23 +0,0 @@
1
- require File.expand_path('spec_helper', __dir__)
2
-
3
- describe Danger::Toc::Constructors do
4
- describe '.get' do
5
- it 'should return constructor for kramdown' do
6
- expect(
7
- described_class.get(:kramdown)
8
- ).to eq(Danger::Toc::Constructors::KramdownConstructor)
9
- end
10
-
11
- it 'should return constructor for github' do
12
- expect(
13
- described_class.get(:github)
14
- ).to eq(Danger::Toc::Constructors::GithubConstructor)
15
- end
16
-
17
- it 'should return error if not found constructor' do
18
- expect do
19
- described_class.get :unknown
20
- end.to raise_error(NameError)
21
- end
22
- end
23
- end
@@ -1,5 +0,0 @@
1
- The quick brown fox jumps over the lazy dog.
2
-
3
- # What is This?
4
-
5
- The quick brown fox jumps over the lazy dog.
@@ -1,11 +0,0 @@
1
- # Prelude
2
-
3
- The quick brown fox jumps over the lazy dog.
4
-
5
- # Custom TOC
6
-
7
- - [What is This?](#what-is-this)
8
-
9
- # What is This?
10
-
11
- The quick brown fox jumps over the lazy dog.