nanoc 4.8.12 → 4.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +6 -0
- data/lib/nanoc/base/entities/document.rb +16 -1
- data/lib/nanoc/base/feature.rb +1 -1
- data/lib/nanoc/base/repos/action_sequence_store.rb +3 -3
- data/lib/nanoc/base/repos/checksum_store.rb +3 -3
- data/lib/nanoc/base/repos/compiled_content_cache.rb +3 -3
- data/lib/nanoc/base/repos/dependency_store.rb +3 -3
- data/lib/nanoc/base/repos/outdatedness_store.rb +3 -3
- data/lib/nanoc/base/repos/store.rb +3 -5
- data/lib/nanoc/base/services/compiler_loader.rb +5 -5
- data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +2 -14
- data/lib/nanoc/cli/commands/compile.rb +18 -0
- data/lib/nanoc/cli/commands/live.rb +1 -0
- data/lib/nanoc/cli/commands/view.rb +12 -35
- data/lib/nanoc/filters/redcarpet.rb +26 -65
- data/lib/nanoc/version.rb +1 -1
- metadata +2 -293
- data/.rspec +0 -3
- data/.rubocop.yml +0 -173
- data/Rakefile +0 -25
- data/nanoc.gemspec +0 -44
- data/nanoc.manifest +0 -543
- data/spec/contributors_spec.rb +0 -20
- data/spec/gem_spec.rb +0 -21
- data/spec/manifest_spec.rb +0 -22
- data/spec/nanoc/base/changes_stream_spec.rb +0 -45
- data/spec/nanoc/base/checksummer_spec.rb +0 -419
- data/spec/nanoc/base/compiler_spec.rb +0 -149
- data/spec/nanoc/base/core_ext/array_spec.rb +0 -35
- data/spec/nanoc/base/core_ext/hash_spec.rb +0 -41
- data/spec/nanoc/base/core_ext/string_spec.rb +0 -23
- data/spec/nanoc/base/directed_graph_spec.rb +0 -258
- data/spec/nanoc/base/entities/action_sequence_spec.rb +0 -297
- data/spec/nanoc/base/entities/code_snippet_spec.rb +0 -60
- data/spec/nanoc/base/entities/configuration_spec.rb +0 -132
- data/spec/nanoc/base/entities/content_spec.rb +0 -195
- data/spec/nanoc/base/entities/context_spec.rb +0 -26
- data/spec/nanoc/base/entities/document_spec.rb +0 -258
- data/spec/nanoc/base/entities/identifiable_collection_spec.rb +0 -209
- data/spec/nanoc/base/entities/identifier_spec.rb +0 -472
- data/spec/nanoc/base/entities/item_rep_spec.rb +0 -26
- data/spec/nanoc/base/entities/item_spec.rb +0 -13
- data/spec/nanoc/base/entities/layout_spec.rb +0 -13
- data/spec/nanoc/base/entities/lazy_value_spec.rb +0 -108
- data/spec/nanoc/base/entities/outdatedness_status_spec.rb +0 -115
- data/spec/nanoc/base/entities/pattern_spec.rb +0 -133
- data/spec/nanoc/base/entities/processing_action_spec.rb +0 -11
- data/spec/nanoc/base/entities/processing_actions/filter_spec.rb +0 -20
- data/spec/nanoc/base/entities/processing_actions/layout_spec.rb +0 -20
- data/spec/nanoc/base/entities/processing_actions/snapshot_spec.rb +0 -40
- data/spec/nanoc/base/entities/props_spec.rb +0 -413
- data/spec/nanoc/base/entities/site_spec.rb +0 -80
- data/spec/nanoc/base/errors/dependency_cycle_spec.rb +0 -35
- data/spec/nanoc/base/feature_spec.rb +0 -109
- data/spec/nanoc/base/filter_spec.rb +0 -166
- data/spec/nanoc/base/item_rep_writer_spec.rb +0 -140
- data/spec/nanoc/base/memoization_spec.rb +0 -108
- data/spec/nanoc/base/repos/aggregate_data_source_spec.rb +0 -87
- data/spec/nanoc/base/repos/checksum_store_spec.rb +0 -155
- data/spec/nanoc/base/repos/compiled_content_cache_spec.rb +0 -65
- data/spec/nanoc/base/repos/config_loader_spec.rb +0 -245
- data/spec/nanoc/base/repos/data_source_spec.rb +0 -95
- data/spec/nanoc/base/repos/dependency_store_spec.rb +0 -515
- data/spec/nanoc/base/repos/in_mem_data_source_spec.rb +0 -39
- data/spec/nanoc/base/repos/outdatedness_store_spec.rb +0 -72
- data/spec/nanoc/base/repos/prefixed_data_source_spec.rb +0 -39
- data/spec/nanoc/base/repos/site_loader_spec.rb +0 -264
- data/spec/nanoc/base/repos/snapshot_repo_spec.rb +0 -316
- data/spec/nanoc/base/repos/store_spec.rb +0 -93
- data/spec/nanoc/base/services/compiler/phases/abstract_spec.rb +0 -63
- data/spec/nanoc/base/services/compiler/phases/cache_spec.rb +0 -156
- data/spec/nanoc/base/services/compiler/stages/calculate_checksums_spec.rb +0 -74
- data/spec/nanoc/base/services/compiler/stages/cleanup_spec.rb +0 -88
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +0 -142
- data/spec/nanoc/base/services/compiler/stages/determine_outdatedness_spec.rb +0 -148
- data/spec/nanoc/base/services/compiler/stages/preprocess_spec.rb +0 -110
- data/spec/nanoc/base/services/dependency_tracker_spec.rb +0 -245
- data/spec/nanoc/base/services/executor_spec.rb +0 -686
- data/spec/nanoc/base/services/item_rep_router_spec.rb +0 -198
- data/spec/nanoc/base/services/item_rep_selector_spec.rb +0 -227
- data/spec/nanoc/base/services/notification_center_spec.rb +0 -25
- data/spec/nanoc/base/services/outdatedness_checker_spec.rb +0 -778
- data/spec/nanoc/base/services/outdatedness_rules_spec.rb +0 -495
- data/spec/nanoc/base/services/pruner_spec.rb +0 -116
- data/spec/nanoc/base/services/temp_filename_factory_spec.rb +0 -89
- data/spec/nanoc/base/views/basic_item_rep_collection_view_spec.rb +0 -8
- data/spec/nanoc/base/views/basic_item_rep_view_spec.rb +0 -9
- data/spec/nanoc/base/views/compilation_item_rep_collection_view_spec.rb +0 -8
- data/spec/nanoc/base/views/compilation_item_rep_view_spec.rb +0 -136
- data/spec/nanoc/base/views/config_view_spec.rb +0 -144
- data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +0 -23
- data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +0 -23
- data/spec/nanoc/base/views/item_view_spec.rb +0 -376
- data/spec/nanoc/base/views/layout_collection_view_spec.rb +0 -23
- data/spec/nanoc/base/views/layout_view_spec.rb +0 -18
- data/spec/nanoc/base/views/mutable_config_view_spec.rb +0 -18
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +0 -60
- data/spec/nanoc/base/views/mutable_item_view_spec.rb +0 -26
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +0 -60
- data/spec/nanoc/base/views/mutable_layout_view_spec.rb +0 -17
- data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +0 -8
- data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +0 -216
- data/spec/nanoc/base/views/post_compile_item_view_spec.rb +0 -58
- data/spec/nanoc/base/views/support/document_view_examples.rb +0 -340
- data/spec/nanoc/base/views/support/identifiable_collection_view_examples.rb +0 -277
- data/spec/nanoc/base/views/support/item_rep_collection_view_examples.rb +0 -140
- data/spec/nanoc/base/views/support/item_rep_view_examples.rb +0 -308
- data/spec/nanoc/base/views/support/mutable_document_view_examples.rb +0 -188
- data/spec/nanoc/base/views/support/mutable_identifiable_collection_view_examples.rb +0 -44
- data/spec/nanoc/checking/runner_spec.rb +0 -26
- data/spec/nanoc/cli/command_runner_spec.rb +0 -107
- data/spec/nanoc/cli/commands/compile/abstract_spec.rb +0 -80
- data/spec/nanoc/cli/commands/compile/diff_generator_spec.rb +0 -44
- data/spec/nanoc/cli/commands/compile/file_action_printer_spec.rb +0 -112
- data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +0 -287
- data/spec/nanoc/cli/commands/compile_spec.rb +0 -45
- data/spec/nanoc/cli/commands/deploy_spec.rb +0 -329
- data/spec/nanoc/cli/commands/shell_spec.rb +0 -77
- data/spec/nanoc/cli/commands/show_data_spec.rb +0 -286
- data/spec/nanoc/cli/commands/show_plugins_spec.rb +0 -20
- data/spec/nanoc/cli/commands/show_rules_spec.rb +0 -118
- data/spec/nanoc/cli/commands/view_spec.rb +0 -75
- data/spec/nanoc/cli/error_handler_spec.rb +0 -43
- data/spec/nanoc/cli/stack_trace_writer_spec.rb +0 -156
- data/spec/nanoc/cli/stream_cleaners/utf8_spec.rb +0 -9
- data/spec/nanoc/cli_spec.rb +0 -44
- data/spec/nanoc/data_sources/filesystem_spec.rb +0 -128
- data/spec/nanoc/deploying/fog_spec.rb +0 -199
- data/spec/nanoc/deploying/git_spec.rb +0 -305
- data/spec/nanoc/extra/live_recompiler_spec.rb +0 -129
- data/spec/nanoc/extra/parallel_collection_spec.rb +0 -110
- data/spec/nanoc/filters/asciidoctor_spec.rb +0 -12
- data/spec/nanoc/filters/colorize_syntax/rouge_spec.rb +0 -155
- data/spec/nanoc/filters/less_spec.rb +0 -122
- data/spec/nanoc/helpers/blogging_spec.rb +0 -219
- data/spec/nanoc/helpers/breadcrumbs_spec.rb +0 -135
- data/spec/nanoc/helpers/capturing_spec.rb +0 -256
- data/spec/nanoc/helpers/child_parent_spec.rb +0 -76
- data/spec/nanoc/helpers/filtering_spec.rb +0 -77
- data/spec/nanoc/helpers/html_escape_spec.rb +0 -37
- data/spec/nanoc/helpers/link_to_spec.rb +0 -320
- data/spec/nanoc/helpers/rendering_spec.rb +0 -144
- data/spec/nanoc/helpers/tagging_spec.rb +0 -106
- data/spec/nanoc/helpers/text_spec.rb +0 -60
- data/spec/nanoc/integration/compile_command_spec.rb +0 -33
- data/spec/nanoc/integration/outdatedness_integration_spec.rb +0 -269
- data/spec/nanoc/integration/partial_recompilation_spec.rb +0 -50
- data/spec/nanoc/regressions/gh_1015_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_1022_spec.rb +0 -26
- data/spec/nanoc/regressions/gh_1031_spec.rb +0 -56
- data/spec/nanoc/regressions/gh_1035_spec.rb +0 -35
- data/spec/nanoc/regressions/gh_1037a_spec.rb +0 -31
- data/spec/nanoc/regressions/gh_1037b_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_1040_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_1045_spec.rb +0 -50
- data/spec/nanoc/regressions/gh_1047_spec.rb +0 -30
- data/spec/nanoc/regressions/gh_1064_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_1067_spec.rb +0 -36
- data/spec/nanoc/regressions/gh_1082a_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_1082b_spec.rb +0 -22
- data/spec/nanoc/regressions/gh_1082c_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_1082d_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_1093_spec.rb +0 -51
- data/spec/nanoc/regressions/gh_1094_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_1097_spec.rb +0 -23
- data/spec/nanoc/regressions/gh_1100_spec.rb +0 -22
- data/spec/nanoc/regressions/gh_1102_spec.rb +0 -28
- data/spec/nanoc/regressions/gh_1107_spec.rb +0 -15
- data/spec/nanoc/regressions/gh_1130_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_1134_spec.rb +0 -29
- data/spec/nanoc/regressions/gh_1145_spec.rb +0 -18
- data/spec/nanoc/regressions/gh_1171_spec.rb +0 -57
- data/spec/nanoc/regressions/gh_1185_spec.rb +0 -22
- data/spec/nanoc/regressions/gh_1216_spec.rb +0 -91
- data/spec/nanoc/regressions/gh_1248_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_761_spec.rb +0 -25
- data/spec/nanoc/regressions/gh_767_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_769_spec.rb +0 -32
- data/spec/nanoc/regressions/gh_776_spec.rb +0 -42
- data/spec/nanoc/regressions/gh_787_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_795_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_804_spec.rb +0 -28
- data/spec/nanoc/regressions/gh_807_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_809_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_813_spec.rb +0 -24
- data/spec/nanoc/regressions/gh_815_spec.rb +0 -20
- data/spec/nanoc/regressions/gh_828_spec.rb +0 -25
- data/spec/nanoc/regressions/gh_833_spec.rb +0 -16
- data/spec/nanoc/regressions/gh_841_spec.rb +0 -17
- data/spec/nanoc/regressions/gh_867_spec.rb +0 -17
- data/spec/nanoc/regressions/gh_882_spec.rb +0 -31
- data/spec/nanoc/regressions/gh_885_spec.rb +0 -32
- data/spec/nanoc/regressions/gh_891_spec.rb +0 -28
- data/spec/nanoc/regressions/gh_913_spec.rb +0 -26
- data/spec/nanoc/regressions/gh_924_spec.rb +0 -91
- data/spec/nanoc/regressions/gh_928_spec.rb +0 -7
- data/spec/nanoc/regressions/gh_937_spec.rb +0 -27
- data/spec/nanoc/regressions/gh_942_spec.rb +0 -23
- data/spec/nanoc/regressions/gh_947_spec.rb +0 -23
- data/spec/nanoc/regressions/gh_948_spec.rb +0 -18
- data/spec/nanoc/regressions/gh_951_spec.rb +0 -21
- data/spec/nanoc/regressions/gh_954_spec.rb +0 -35
- data/spec/nanoc/regressions/gh_970a_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_970b_spec.rb +0 -52
- data/spec/nanoc/regressions/gh_974_spec.rb +0 -19
- data/spec/nanoc/regressions/gh_981_spec.rb +0 -23
- data/spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb +0 -230
- data/spec/nanoc/rule_dsl/recording_executor_spec.rb +0 -145
- data/spec/nanoc/rule_dsl/rule_context_spec.rb +0 -251
- data/spec/nanoc/rule_dsl/rule_spec.rb +0 -111
- data/spec/nanoc/rule_dsl/rules_collection_spec.rb +0 -301
- data/spec/nanoc/spec_spec.rb +0 -70
- data/spec/nanoc/telemetry/counter_spec.rb +0 -20
- data/spec/nanoc/telemetry/labelled_counter_spec.rb +0 -94
- data/spec/nanoc/telemetry/labelled_summary_spec.rb +0 -78
- data/spec/nanoc/telemetry/stopwatch_spec.rb +0 -63
- data/spec/nanoc/telemetry/summary_spec.rb +0 -68
- data/spec/nanoc/telemetry/table_spec.rb +0 -22
- data/spec/nanoc/telemetry_spec.rb +0 -28
- data/spec/regression_filenames_spec.rb +0 -18
- data/spec/spec_helper.rb +0 -371
- data/test/base/test_compiler.rb +0 -389
- data/test/base/test_filter.rb +0 -73
- data/test/base/test_site.rb +0 -146
- data/test/checking/checks/test_css.rb +0 -66
- data/test/checking/checks/test_external_links.rb +0 -88
- data/test/checking/checks/test_html.rb +0 -47
- data/test/checking/checks/test_internal_links.rb +0 -118
- data/test/checking/checks/test_mixed_content.rb +0 -190
- data/test/checking/checks/test_stale.rb +0 -69
- data/test/checking/test_check.rb +0 -22
- data/test/checking/test_dsl.rb +0 -35
- data/test/checking/test_runner.rb +0 -45
- data/test/cli/commands/test_check.rb +0 -20
- data/test/cli/commands/test_compile.rb +0 -199
- data/test/cli/commands/test_create_site.rb +0 -126
- data/test/cli/commands/test_help.rb +0 -10
- data/test/cli/commands/test_prune.rb +0 -157
- data/test/cli/test_cleaning_stream.rb +0 -97
- data/test/cli/test_cli.rb +0 -195
- data/test/cli/test_error_handler.rb +0 -102
- data/test/cli/test_logger.rb +0 -7
- data/test/data_sources/test_filesystem.rb +0 -1033
- data/test/data_sources/test_filesystem_tools.rb +0 -146
- data/test/deploying/test_fog.rb +0 -117
- data/test/deploying/test_git.rb +0 -263
- data/test/deploying/test_rsync.rb +0 -94
- data/test/extra/core_ext/test_time.rb +0 -17
- data/test/extra/test_link_collector.rb +0 -110
- data/test/extra/test_piper.rb +0 -48
- data/test/filters/colorize_syntax/test_coderay.rb +0 -247
- data/test/filters/colorize_syntax/test_common.rb +0 -109
- data/test/filters/colorize_syntax/test_pygmentize.rb +0 -39
- data/test/filters/colorize_syntax/test_pygments.rb +0 -21
- data/test/filters/colorize_syntax/test_simon.rb +0 -24
- data/test/filters/test_asciidoc.rb +0 -16
- data/test/filters/test_bluecloth.rb +0 -16
- data/test/filters/test_coffeescript.rb +0 -16
- data/test/filters/test_erb.rb +0 -107
- data/test/filters/test_erubi.rb +0 -75
- data/test/filters/test_erubis.rb +0 -76
- data/test/filters/test_haml.rb +0 -94
- data/test/filters/test_handlebars.rb +0 -61
- data/test/filters/test_kramdown.rb +0 -56
- data/test/filters/test_markaby.rb +0 -16
- data/test/filters/test_maruku.rb +0 -16
- data/test/filters/test_mustache.rb +0 -43
- data/test/filters/test_pandoc.rb +0 -47
- data/test/filters/test_rainpress.rb +0 -27
- data/test/filters/test_rdiscount.rb +0 -30
- data/test/filters/test_rdoc.rb +0 -14
- data/test/filters/test_redcarpet.rb +0 -111
- data/test/filters/test_redcloth.rb +0 -31
- data/test/filters/test_relativize_paths.rb +0 -887
- data/test/filters/test_rubypants.rb +0 -16
- data/test/filters/test_sass.rb +0 -315
- data/test/filters/test_slim.rb +0 -59
- data/test/filters/test_typogruby.rb +0 -18
- data/test/filters/test_uglify_js.rb +0 -30
- data/test/filters/test_xsl.rb +0 -192
- data/test/filters/test_yui_compressor.rb +0 -42
- data/test/fixtures/vcr_cassettes/css_run_error.yml +0 -70
- data/test/fixtures/vcr_cassettes/css_run_ok.yml +0 -60
- data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +0 -70
- data/test/fixtures/vcr_cassettes/html_run_error.yml +0 -56
- data/test/fixtures/vcr_cassettes/html_run_ok.yml +0 -58
- data/test/helper.rb +0 -255
- data/test/helpers/test_blogging.rb +0 -684
- data/test/helpers/test_capturing.rb +0 -184
- data/test/helpers/test_link_to.rb +0 -57
- data/test/helpers/test_xml_sitemap.rb +0 -246
- data/test/rule_dsl/test_action_provider.rb +0 -80
- data/test/rule_dsl/test_compiler_dsl.rb +0 -448
- data/test/rule_dsl/test_rules_collection.rb +0 -93
@@ -1,209 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Int::IdentifiableCollection do
|
4
|
-
shared_examples 'a generic identifiable collection' do
|
5
|
-
subject(:identifiable_collection) { described_class.new(config, objects) }
|
6
|
-
|
7
|
-
let(:config) { Nanoc::Int::Configuration.new }
|
8
|
-
let(:objects) { [] }
|
9
|
-
|
10
|
-
describe '#reject' do
|
11
|
-
subject { identifiable_collection.reject { |_| false } }
|
12
|
-
|
13
|
-
it { is_expected.to be_a(described_class) }
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '#inspect' do
|
17
|
-
subject { identifiable_collection.inspect }
|
18
|
-
|
19
|
-
it { is_expected.to eq("<#{described_class}>") }
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#[]' do
|
23
|
-
let(:objects) do
|
24
|
-
[
|
25
|
-
Nanoc::Int::Item.new('asdf', {}, Nanoc::Identifier.new('/one')),
|
26
|
-
Nanoc::Int::Item.new('asdf', {}, Nanoc::Identifier.new('/two')),
|
27
|
-
]
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'string pattern style is glob' do
|
31
|
-
let(:config) { Nanoc::Int::Configuration.new.with_defaults }
|
32
|
-
|
33
|
-
it 'handles glob' do
|
34
|
-
expect(identifiable_collection['/on*']).to equal(objects[0])
|
35
|
-
expect(identifiable_collection['/*wo']).to equal(objects[1])
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'string pattern style is glob' do
|
40
|
-
let(:config) { Nanoc::Int::Configuration.new }
|
41
|
-
|
42
|
-
it 'does not handle glob' do
|
43
|
-
expect(identifiable_collection['/on*']).to be_nil
|
44
|
-
expect(identifiable_collection['/*wo']).to be_nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'handles identifier' do
|
49
|
-
expect(identifiable_collection['/one']).to equal(objects[0])
|
50
|
-
expect(identifiable_collection['/two']).to equal(objects[1])
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'handles malformed identifier' do
|
54
|
-
expect(identifiable_collection['one/']).to be_nil
|
55
|
-
expect(identifiable_collection['/one/']).to be_nil
|
56
|
-
expect(identifiable_collection['one']).to be_nil
|
57
|
-
expect(identifiable_collection['//one']).to be_nil
|
58
|
-
expect(identifiable_collection['/one//']).to be_nil
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'handles regex' do
|
62
|
-
expect(identifiable_collection[/one/]).to equal(objects[0])
|
63
|
-
expect(identifiable_collection[/on/]).to equal(objects[0])
|
64
|
-
expect(identifiable_collection[/\/o/]).to equal(objects[0])
|
65
|
-
expect(identifiable_collection[/e$/]).to equal(objects[0])
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'frozen' do
|
69
|
-
before { identifiable_collection.freeze }
|
70
|
-
|
71
|
-
example do
|
72
|
-
expect(identifiable_collection['/one']).to equal(objects[0])
|
73
|
-
expect(identifiable_collection['/fifty']).to be_nil
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#find_all' do
|
79
|
-
let(:objects) do
|
80
|
-
[
|
81
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/about.css')),
|
82
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/about.md')),
|
83
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/style.css')),
|
84
|
-
]
|
85
|
-
end
|
86
|
-
|
87
|
-
let(:arg) { raise 'override me' }
|
88
|
-
|
89
|
-
subject { identifiable_collection.find_all(arg) }
|
90
|
-
|
91
|
-
context 'with string' do
|
92
|
-
let(:arg) { '/*.css' }
|
93
|
-
|
94
|
-
it 'contains objects' do
|
95
|
-
expect(subject.size).to eql(2)
|
96
|
-
expect(subject.find { |iv| iv.identifier == '/about.css' }).to eq(objects[0])
|
97
|
-
expect(subject.find { |iv| iv.identifier == '/style.css' }).to eq(objects[2])
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context 'with regex' do
|
102
|
-
let(:arg) { %r{\.css\z} }
|
103
|
-
|
104
|
-
it 'contains objects' do
|
105
|
-
expect(subject.size).to eql(2)
|
106
|
-
expect(subject.find { |iv| iv.identifier == '/about.css' }).to eq(objects[0])
|
107
|
-
expect(subject.find { |iv| iv.identifier == '/style.css' }).to eq(objects[2])
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe '#object_with_identifier' do
|
113
|
-
let(:objects) do
|
114
|
-
[
|
115
|
-
Nanoc::Int::Item.new('stuff', {}, Nanoc::Identifier.new('/about.css')),
|
116
|
-
Nanoc::Int::Item.new('stuff', {}, Nanoc::Identifier.new('/about.md')),
|
117
|
-
Nanoc::Int::Item.new('stuff', {}, Nanoc::Identifier.new('/style.css')),
|
118
|
-
]
|
119
|
-
end
|
120
|
-
|
121
|
-
let(:arg) { raise 'override me' }
|
122
|
-
|
123
|
-
subject { identifiable_collection.object_with_identifier(arg) }
|
124
|
-
|
125
|
-
context 'with string' do
|
126
|
-
let(:arg) { '/about.css' }
|
127
|
-
it { is_expected.to eq(objects[0]) }
|
128
|
-
end
|
129
|
-
|
130
|
-
context 'with identifier' do
|
131
|
-
let(:arg) { Nanoc::Identifier.new('/about.css') }
|
132
|
-
it { is_expected.to eq(objects[0]) }
|
133
|
-
end
|
134
|
-
|
135
|
-
context 'with glob string' do
|
136
|
-
let(:arg) { '/about.*' }
|
137
|
-
it { is_expected.to be_nil }
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe '#reference' do
|
142
|
-
subject { identifiable_collection.reference }
|
143
|
-
it { is_expected.to eql(expected_reference) }
|
144
|
-
end
|
145
|
-
|
146
|
-
describe 'changing identifiers' do
|
147
|
-
let(:objects) do
|
148
|
-
[
|
149
|
-
Nanoc::Int::Item.new('Foo', {}, '/foo'),
|
150
|
-
]
|
151
|
-
end
|
152
|
-
|
153
|
-
subject { objects[0].identifier = '/bar' }
|
154
|
-
|
155
|
-
it 'makes /foo nil' do
|
156
|
-
expect { subject }
|
157
|
-
.to change { identifiable_collection['/foo'] }
|
158
|
-
.from(objects[0])
|
159
|
-
.to(nil)
|
160
|
-
end
|
161
|
-
|
162
|
-
it 'makes /bar non-nil' do
|
163
|
-
expect { subject }
|
164
|
-
.to change { identifiable_collection['/bar'] }
|
165
|
-
.from(nil)
|
166
|
-
.to(objects[0])
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
describe '#each' do
|
171
|
-
let(:objects) do
|
172
|
-
[
|
173
|
-
Nanoc::Int::Item.new('Foo', {}, '/foo'),
|
174
|
-
Nanoc::Int::Item.new('Bar', {}, '/bar'),
|
175
|
-
]
|
176
|
-
end
|
177
|
-
|
178
|
-
it 'loops' do
|
179
|
-
res = []
|
180
|
-
identifiable_collection.each { |i| res << i.identifier.to_s }
|
181
|
-
expect(res).to match_array(['/foo', '/bar'])
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
describe '#map' do
|
186
|
-
let(:objects) do
|
187
|
-
[
|
188
|
-
Nanoc::Int::Item.new('Foo', {}, '/foo'),
|
189
|
-
Nanoc::Int::Item.new('Bar', {}, '/bar'),
|
190
|
-
]
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'loops' do
|
194
|
-
res = identifiable_collection.map { |i| i.identifier.to_s }
|
195
|
-
expect(res).to match_array(['/foo', '/bar'])
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
describe Nanoc::Int::ItemCollection do
|
201
|
-
let(:expected_reference) { 'items' }
|
202
|
-
it_behaves_like 'a generic identifiable collection'
|
203
|
-
end
|
204
|
-
|
205
|
-
describe Nanoc::Int::LayoutCollection do
|
206
|
-
let(:expected_reference) { 'layouts' }
|
207
|
-
it_behaves_like 'a generic identifiable collection'
|
208
|
-
end
|
209
|
-
end
|
@@ -1,472 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Identifier do
|
4
|
-
describe '.from' do
|
5
|
-
subject { described_class.from(arg) }
|
6
|
-
|
7
|
-
context 'given an identifier' do
|
8
|
-
let(:arg) { Nanoc::Identifier.new('/foo.md') }
|
9
|
-
|
10
|
-
it 'returns an identifier' do
|
11
|
-
expect(subject).to be_a(Nanoc::Identifier)
|
12
|
-
expect(subject.to_s).to eq('/foo.md')
|
13
|
-
expect(subject).to be_full
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'given a string' do
|
18
|
-
let(:arg) { '/foo.md' }
|
19
|
-
|
20
|
-
it 'returns an identifier' do
|
21
|
-
expect(subject).to be_a(Nanoc::Identifier)
|
22
|
-
expect(subject.to_s).to eq('/foo.md')
|
23
|
-
expect(subject).to be_full
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'given something else' do
|
28
|
-
let(:arg) { 12_345 }
|
29
|
-
|
30
|
-
it 'raises' do
|
31
|
-
expect { subject }.to raise_error(Nanoc::Identifier::NonCoercibleObjectError)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '#initialize' do
|
37
|
-
context 'legacy type' do
|
38
|
-
it 'does not convert already clean paths' do
|
39
|
-
expect(described_class.new('/foo/bar/', type: :legacy).to_s).to eql('/foo/bar/')
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'prepends slash if necessary' do
|
43
|
-
expect(described_class.new('foo/bar/', type: :legacy).to_s).to eql('/foo/bar/')
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'appends slash if necessary' do
|
47
|
-
expect(described_class.new('/foo/bar', type: :legacy).to_s).to eql('/foo/bar/')
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'removes double slashes at start' do
|
51
|
-
expect(described_class.new('//foo/bar/', type: :legacy).to_s).to eql('/foo/bar/')
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'removes double slashes at end' do
|
55
|
-
expect(described_class.new('/foo/bar//', type: :legacy).to_s).to eql('/foo/bar/')
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'freezes' do
|
59
|
-
identifier = described_class.new('/foo/bar/', type: :legacy)
|
60
|
-
expect { identifier.to_s << 'bbq' }.to raise_frozen_error
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'full type' do
|
65
|
-
it 'refuses string not starting with a slash' do
|
66
|
-
expect { described_class.new('foo') }
|
67
|
-
.to raise_error(Nanoc::Identifier::InvalidIdentifierError)
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'refuses string ending with a slash' do
|
71
|
-
expect { described_class.new('/foo/') }
|
72
|
-
.to raise_error(Nanoc::Identifier::InvalidFullIdentifierError)
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'refuses string with only slash' do
|
76
|
-
expect { described_class.new('/') }
|
77
|
-
.to raise_error(Nanoc::Identifier::InvalidFullIdentifierError)
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'has proper string representation' do
|
81
|
-
expect(described_class.new('/foo').to_s).to eql('/foo')
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'freezes' do
|
85
|
-
identifier = described_class.new('/foo/bar')
|
86
|
-
expect { identifier.to_s << 'bbq' }.to raise_frozen_error
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'other type' do
|
91
|
-
it 'errors' do
|
92
|
-
expect { described_class.new('foo', type: :donkey) }
|
93
|
-
.to raise_error(Nanoc::Identifier::InvalidTypeError)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'default type' do
|
98
|
-
it 'is full' do
|
99
|
-
expect(described_class.new('/foo')).to be_full
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'other args specified' do
|
104
|
-
it 'errors' do
|
105
|
-
expect { described_class.new('?', animal: :donkey) }
|
106
|
-
.to raise_error(ArgumentError)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe '#to_s' do
|
112
|
-
it 'returns immutable string' do
|
113
|
-
expect { described_class.new('foo/', type: :legacy).to_s << 'lols' }.to raise_frozen_error
|
114
|
-
expect { described_class.new('/foo').to_s << 'lols' }.to raise_frozen_error
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe '#to_str' do
|
119
|
-
it 'returns immutable string' do
|
120
|
-
expect { described_class.new('/foo/bar').to_str << 'lols' }.to raise_frozen_error
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe 'Comparable' do
|
125
|
-
it 'can be compared' do
|
126
|
-
expect(described_class.new('/foo/bar') <= '/qux').to eql(true)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe '#inspect' do
|
131
|
-
let(:identifier) { described_class.new('/foo/bar') }
|
132
|
-
|
133
|
-
subject { identifier.inspect }
|
134
|
-
|
135
|
-
it { should == '<Nanoc::Identifier type=full "/foo/bar">' }
|
136
|
-
end
|
137
|
-
|
138
|
-
describe '#== and #eql?' do
|
139
|
-
context 'comparing with equal identifier' do
|
140
|
-
let(:identifier_a) { described_class.new('//foo/bar/', type: :legacy) }
|
141
|
-
let(:identifier_b) { described_class.new('/foo/bar//', type: :legacy) }
|
142
|
-
|
143
|
-
it 'is ==' do
|
144
|
-
expect(identifier_a).to eq(identifier_b)
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'is eql?' do
|
148
|
-
expect(identifier_a).to eql(identifier_b)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
context 'comparing with equal string' do
|
153
|
-
let(:identifier_a) { described_class.new('//foo/bar/', type: :legacy) }
|
154
|
-
let(:identifier_b) { '/foo/bar/' }
|
155
|
-
|
156
|
-
it 'is ==' do
|
157
|
-
expect(identifier_a).to eq(identifier_b.to_s)
|
158
|
-
end
|
159
|
-
|
160
|
-
it 'is not eql?' do
|
161
|
-
expect(identifier_a).not_to eql(identifier_b.to_s)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
context 'comparing with different identifier' do
|
166
|
-
let(:identifier_a) { described_class.new('//foo/bar/', type: :legacy) }
|
167
|
-
let(:identifier_b) { described_class.new('/baz/qux//', type: :legacy) }
|
168
|
-
|
169
|
-
it 'is not ==' do
|
170
|
-
expect(identifier_a).not_to eq(identifier_b)
|
171
|
-
end
|
172
|
-
|
173
|
-
it 'is not eql?' do
|
174
|
-
expect(identifier_a).not_to eql(identifier_b)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
context 'comparing with different string' do
|
179
|
-
let(:identifier_a) { described_class.new('//foo/bar/', type: :legacy) }
|
180
|
-
let(:identifier_b) { '/baz/qux/' }
|
181
|
-
|
182
|
-
it 'is not equal' do
|
183
|
-
expect(identifier_a).not_to eq(identifier_b)
|
184
|
-
end
|
185
|
-
|
186
|
-
it 'is not eql?' do
|
187
|
-
expect(identifier_a).not_to eql(identifier_b)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
context 'comparing with something that is not an identifier' do
|
192
|
-
let(:identifier_a) { described_class.new('//foo/bar/', type: :legacy) }
|
193
|
-
let(:identifier_b) { :donkey }
|
194
|
-
|
195
|
-
it 'is not equal' do
|
196
|
-
expect(identifier_a).not_to eq(identifier_b)
|
197
|
-
expect(identifier_a).not_to eql(identifier_b)
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
describe '#hash' do
|
203
|
-
context 'equal identifiers' do
|
204
|
-
let(:identifier_a) { described_class.new('//foo/bar/', type: :legacy) }
|
205
|
-
let(:identifier_b) { described_class.new('/foo/bar//', type: :legacy) }
|
206
|
-
|
207
|
-
it 'is the same' do
|
208
|
-
expect(identifier_a.hash == identifier_b.hash).to eql(true)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
context 'different identifiers' do
|
213
|
-
let(:identifier_a) { described_class.new('//foo/bar/', type: :legacy) }
|
214
|
-
let(:identifier_b) { described_class.new('/monkey/', type: :legacy) }
|
215
|
-
|
216
|
-
it 'is different' do
|
217
|
-
expect(identifier_a.hash == identifier_b.hash).to eql(false)
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
describe '#=~' do
|
223
|
-
let(:identifier) { described_class.new('/foo/bar') }
|
224
|
-
|
225
|
-
subject { identifier =~ pat }
|
226
|
-
|
227
|
-
context 'given a regex' do
|
228
|
-
context 'matching regex' do
|
229
|
-
let(:pat) { %r{\A/foo/bar} }
|
230
|
-
it { is_expected.to eql(0) }
|
231
|
-
end
|
232
|
-
|
233
|
-
context 'non-matching regex' do
|
234
|
-
let(:pat) { %r{\A/qux/monkey} }
|
235
|
-
it { is_expected.to eql(nil) }
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
context 'given a string' do
|
240
|
-
context 'matching string' do
|
241
|
-
let(:pat) { '/foo/*' }
|
242
|
-
it { is_expected.to eql(0) }
|
243
|
-
end
|
244
|
-
|
245
|
-
context 'non-matching string' do
|
246
|
-
let(:pat) { '/qux/*' }
|
247
|
-
it { is_expected.to eql(nil) }
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
describe '#<=>' do
|
253
|
-
let(:identifier) { described_class.new('/foo/bar') }
|
254
|
-
|
255
|
-
it 'compares by string' do
|
256
|
-
expect(identifier <=> '/foo/aarghh').to eql(1)
|
257
|
-
expect(identifier <=> '/foo/bar').to eql(0)
|
258
|
-
expect(identifier <=> '/foo/qux').to eql(-1)
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
describe '#prefix' do
|
263
|
-
let(:identifier) { described_class.new('/foo') }
|
264
|
-
|
265
|
-
subject { identifier.prefix(prefix) }
|
266
|
-
|
267
|
-
context 'prefix not ending nor starting with a slash' do
|
268
|
-
let(:prefix) { 'asdf' }
|
269
|
-
|
270
|
-
it 'raises an error' do
|
271
|
-
expect { subject }.to raise_error(
|
272
|
-
Nanoc::Identifier::InvalidPrefixError,
|
273
|
-
'Invalid prefix (does not start with a slash): "asdf"',
|
274
|
-
)
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
context 'prefix ending with a slash' do
|
279
|
-
let(:prefix) { 'asdf/' }
|
280
|
-
|
281
|
-
it 'raises an error' do
|
282
|
-
expect { subject }.to raise_error(
|
283
|
-
Nanoc::Identifier::InvalidPrefixError,
|
284
|
-
'Invalid prefix (does not start with a slash): "asdf/"',
|
285
|
-
)
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
context 'prefix ending and starting with a slash' do
|
290
|
-
let(:prefix) { '/asdf/' }
|
291
|
-
|
292
|
-
it 'returns a proper new identifier' do
|
293
|
-
expect(subject).to be_a(Nanoc::Identifier)
|
294
|
-
expect(subject.to_s).to eql('/asdf/foo')
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
context 'prefix nstarting with a slash' do
|
299
|
-
let(:prefix) { '/asdf' }
|
300
|
-
|
301
|
-
it 'returns a proper new identifier' do
|
302
|
-
expect(subject).to be_a(Nanoc::Identifier)
|
303
|
-
expect(subject.to_s).to eql('/asdf/foo')
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
describe '#without_ext' do
|
309
|
-
subject { identifier.without_ext }
|
310
|
-
|
311
|
-
context 'legacy type' do
|
312
|
-
let(:identifier) { described_class.new('/foo/', type: :legacy) }
|
313
|
-
|
314
|
-
it 'raises an error' do
|
315
|
-
expect { subject }.to raise_error(Nanoc::Identifier::UnsupportedLegacyOperationError)
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
context 'identifier with no extension' do
|
320
|
-
let(:identifier) { described_class.new('/foo') }
|
321
|
-
|
322
|
-
it 'does nothing' do
|
323
|
-
expect(subject).to eql('/foo')
|
324
|
-
end
|
325
|
-
end
|
326
|
-
|
327
|
-
context 'identifier with extension' do
|
328
|
-
let(:identifier) { described_class.new('/foo.md') }
|
329
|
-
|
330
|
-
it 'removes the extension' do
|
331
|
-
expect(subject).to eql('/foo')
|
332
|
-
end
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
describe '#ext' do
|
337
|
-
subject { identifier.ext }
|
338
|
-
|
339
|
-
context 'legacy type' do
|
340
|
-
let(:identifier) { described_class.new('/foo/', type: :legacy) }
|
341
|
-
|
342
|
-
it 'raises an error' do
|
343
|
-
expect { subject }.to raise_error(Nanoc::Identifier::UnsupportedLegacyOperationError)
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
context 'identifier with no extension' do
|
348
|
-
let(:identifier) { described_class.new('/foo') }
|
349
|
-
|
350
|
-
it { is_expected.to be_nil }
|
351
|
-
end
|
352
|
-
|
353
|
-
context 'identifier with extension' do
|
354
|
-
let(:identifier) { described_class.new('/foo.md') }
|
355
|
-
|
356
|
-
it { is_expected.to eql('md') }
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
describe '#without_exts' do
|
361
|
-
subject { identifier.without_exts }
|
362
|
-
|
363
|
-
context 'legacy type' do
|
364
|
-
let(:identifier) { described_class.new('/foo/', type: :legacy) }
|
365
|
-
|
366
|
-
it 'raises an error' do
|
367
|
-
expect { subject }.to raise_error(Nanoc::Identifier::UnsupportedLegacyOperationError)
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
|
-
context 'identifier with no extension' do
|
372
|
-
let(:identifier) { described_class.new('/foo') }
|
373
|
-
|
374
|
-
it 'does nothing' do
|
375
|
-
expect(subject).to eql('/foo')
|
376
|
-
end
|
377
|
-
end
|
378
|
-
|
379
|
-
context 'identifier with one extension' do
|
380
|
-
let(:identifier) { described_class.new('/foo.md') }
|
381
|
-
|
382
|
-
it 'removes the extension' do
|
383
|
-
expect(subject).to eql('/foo')
|
384
|
-
end
|
385
|
-
end
|
386
|
-
|
387
|
-
context 'identifier with multiple extensions' do
|
388
|
-
let(:identifier) { described_class.new('/foo.html.md') }
|
389
|
-
|
390
|
-
it 'removes the extension' do
|
391
|
-
expect(subject).to eql('/foo')
|
392
|
-
end
|
393
|
-
end
|
394
|
-
end
|
395
|
-
|
396
|
-
describe '#exts' do
|
397
|
-
subject { identifier.exts }
|
398
|
-
|
399
|
-
context 'legacy type' do
|
400
|
-
let(:identifier) { described_class.new('/foo/', type: :legacy) }
|
401
|
-
|
402
|
-
it 'raises an error' do
|
403
|
-
expect { subject }.to raise_error(Nanoc::Identifier::UnsupportedLegacyOperationError)
|
404
|
-
end
|
405
|
-
end
|
406
|
-
|
407
|
-
context 'identifier with no extension' do
|
408
|
-
let(:identifier) { described_class.new('/foo') }
|
409
|
-
|
410
|
-
it { is_expected.to be_empty }
|
411
|
-
end
|
412
|
-
|
413
|
-
context 'identifier with one extension' do
|
414
|
-
let(:identifier) { described_class.new('/foo.md') }
|
415
|
-
|
416
|
-
it { is_expected.to eql(['md']) }
|
417
|
-
end
|
418
|
-
|
419
|
-
context 'identifier with multiple extensions' do
|
420
|
-
let(:identifier) { described_class.new('/foo.html.md') }
|
421
|
-
|
422
|
-
it { is_expected.to eql(%w[html md]) }
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
describe '#legacy?' do
|
427
|
-
subject { identifier.legacy? }
|
428
|
-
|
429
|
-
context 'legacy type' do
|
430
|
-
let(:identifier) { described_class.new('/foo/', type: :legacy) }
|
431
|
-
it { is_expected.to eql(true) }
|
432
|
-
end
|
433
|
-
|
434
|
-
context 'full type' do
|
435
|
-
let(:identifier) { described_class.new('/foo', type: :full) }
|
436
|
-
it { is_expected.to eql(false) }
|
437
|
-
end
|
438
|
-
end
|
439
|
-
|
440
|
-
describe '#full?' do
|
441
|
-
subject { identifier.full? }
|
442
|
-
|
443
|
-
context 'legacy type' do
|
444
|
-
let(:identifier) { described_class.new('/foo/', type: :legacy) }
|
445
|
-
it { is_expected.to eql(false) }
|
446
|
-
end
|
447
|
-
|
448
|
-
context 'full type' do
|
449
|
-
let(:identifier) { described_class.new('/foo', type: :full) }
|
450
|
-
it { is_expected.to eql(true) }
|
451
|
-
end
|
452
|
-
end
|
453
|
-
|
454
|
-
describe '#components' do
|
455
|
-
subject { identifier.components }
|
456
|
-
|
457
|
-
context 'no components' do
|
458
|
-
let(:identifier) { described_class.new('/', type: :legacy) }
|
459
|
-
it { is_expected.to eql([]) }
|
460
|
-
end
|
461
|
-
|
462
|
-
context 'one component' do
|
463
|
-
let(:identifier) { described_class.new('/foo.md') }
|
464
|
-
it { is_expected.to eql(['foo.md']) }
|
465
|
-
end
|
466
|
-
|
467
|
-
context 'two components' do
|
468
|
-
let(:identifier) { described_class.new('/foo/bar.md') }
|
469
|
-
it { is_expected.to eql(['foo', 'bar.md']) }
|
470
|
-
end
|
471
|
-
end
|
472
|
-
end
|