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,340 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
shared_examples 'a document view' do
|
4
|
-
let(:view) { described_class.new(document, view_context) }
|
5
|
-
|
6
|
-
let(:view_context) do
|
7
|
-
Nanoc::ViewContextForCompilation.new(
|
8
|
-
reps: Nanoc::Int::ItemRepRepo.new,
|
9
|
-
items: Nanoc::Int::ItemCollection.new(config),
|
10
|
-
dependency_tracker: dependency_tracker,
|
11
|
-
compilation_context: double(:compilation_context),
|
12
|
-
snapshot_repo: double(:snapshot_repo),
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:dependency_tracker) { Nanoc::Int::DependencyTracker.new(dependency_store) }
|
17
|
-
let(:dependency_store) { Nanoc::Int::DependencyStore.new(empty_items, empty_layouts, config) }
|
18
|
-
let(:base_item) { Nanoc::Int::Item.new('base', {}, '/base.md') }
|
19
|
-
|
20
|
-
let(:empty_items) { Nanoc::Int::ItemCollection.new(config) }
|
21
|
-
let(:empty_layouts) { Nanoc::Int::LayoutCollection.new(config) }
|
22
|
-
|
23
|
-
let(:config) { Nanoc::Int::Configuration.new.with_defaults }
|
24
|
-
|
25
|
-
before do
|
26
|
-
dependency_tracker.enter(base_item)
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#frozen?' do
|
30
|
-
let(:document) { entity_class.new('content', {}, '/asdf') }
|
31
|
-
|
32
|
-
subject { view.frozen? }
|
33
|
-
|
34
|
-
context 'non-frozen document' do
|
35
|
-
it { is_expected.to be(false) }
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'frozen document' do
|
39
|
-
before { document.freeze }
|
40
|
-
it { is_expected.to be(true) }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#== and #eql?' do
|
45
|
-
let(:document) { entity_class.new('content', {}, '/asdf') }
|
46
|
-
|
47
|
-
context 'comparing with document with same identifier' do
|
48
|
-
let(:other) { entity_class.new('content', {}, '/asdf') }
|
49
|
-
|
50
|
-
it 'is ==' do
|
51
|
-
expect(view).to eq(other)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'is not eql?' do
|
55
|
-
expect(view).not_to eql(other)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'comparing with document with different identifier' do
|
60
|
-
let(:other) { entity_class.new('content', {}, '/fdsa') }
|
61
|
-
|
62
|
-
it 'is not ==' do
|
63
|
-
expect(view).not_to eq(other)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'is not eql?' do
|
67
|
-
expect(view).not_to eql(other)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'comparing with document view with same identifier' do
|
72
|
-
let(:other) { other_view_class.new(entity_class.new('content', {}, '/asdf'), nil) }
|
73
|
-
|
74
|
-
it 'is ==' do
|
75
|
-
expect(view).to eq(other)
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'is not eql?' do
|
79
|
-
expect(view).not_to eql(other)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context 'comparing with document view with different identifier' do
|
84
|
-
let(:other) { other_view_class.new(entity_class.new('content', {}, '/fdsa'), nil) }
|
85
|
-
|
86
|
-
it 'is not ==' do
|
87
|
-
expect(view).not_to eq(other)
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'is not eql?' do
|
91
|
-
expect(view).not_to eql(other)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context 'comparing with other object' do
|
96
|
-
let(:other) { nil }
|
97
|
-
|
98
|
-
it 'is not ==' do
|
99
|
-
expect(view).not_to eq(other)
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'is not eql?' do
|
103
|
-
expect(view).not_to eql(other)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe '#[]' do
|
109
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
110
|
-
|
111
|
-
subject { view[key] }
|
112
|
-
|
113
|
-
context 'with existant key' do
|
114
|
-
let(:key) { :animal }
|
115
|
-
|
116
|
-
it { is_expected.to eql('donkey') }
|
117
|
-
|
118
|
-
it 'creates a dependency' do
|
119
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'creates a dependency with the right props' do
|
123
|
-
subject
|
124
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
125
|
-
|
126
|
-
expect(dep.props.attributes?).to eq(true)
|
127
|
-
|
128
|
-
expect(dep.props.raw_content?).to eq(false)
|
129
|
-
expect(dep.props.compiled_content?).to eq(false)
|
130
|
-
expect(dep.props.path?).to eq(false)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
context 'with non-existant key' do
|
135
|
-
let(:key) { :weapon }
|
136
|
-
|
137
|
-
it { is_expected.to eql(nil) }
|
138
|
-
|
139
|
-
it 'creates a dependency' do
|
140
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'creates a dependency with the right props' do
|
144
|
-
subject
|
145
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
146
|
-
|
147
|
-
expect(dep.props.attributes?).to eq(true)
|
148
|
-
|
149
|
-
expect(dep.props.raw_content?).to eq(false)
|
150
|
-
expect(dep.props.compiled_content?).to eq(false)
|
151
|
-
expect(dep.props.path?).to eq(false)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe '#attributes' do
|
157
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
158
|
-
|
159
|
-
subject { view.attributes }
|
160
|
-
|
161
|
-
it 'creates a dependency' do
|
162
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
163
|
-
end
|
164
|
-
|
165
|
-
it 'creates a dependency with the right props' do
|
166
|
-
subject
|
167
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
168
|
-
|
169
|
-
expect(dep.props.attributes?).to eq(true)
|
170
|
-
|
171
|
-
expect(dep.props.raw_content?).to eq(false)
|
172
|
-
expect(dep.props.compiled_content?).to eq(false)
|
173
|
-
expect(dep.props.path?).to eq(false)
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'returns attributes' do
|
177
|
-
expect(subject).to eql(animal: 'donkey')
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
describe '#fetch' do
|
182
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
183
|
-
|
184
|
-
context 'with existant key' do
|
185
|
-
let(:key) { :animal }
|
186
|
-
|
187
|
-
subject { view.fetch(key) }
|
188
|
-
|
189
|
-
it { is_expected.to eql('donkey') }
|
190
|
-
|
191
|
-
it 'creates a dependency' do
|
192
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'creates a dependency with the right props' do
|
196
|
-
subject
|
197
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
198
|
-
|
199
|
-
expect(dep.props.attributes?).to eq(true)
|
200
|
-
|
201
|
-
expect(dep.props.raw_content?).to eq(false)
|
202
|
-
expect(dep.props.compiled_content?).to eq(false)
|
203
|
-
expect(dep.props.path?).to eq(false)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
context 'with non-existant key' do
|
208
|
-
let(:key) { :weapon }
|
209
|
-
|
210
|
-
context 'with fallback' do
|
211
|
-
subject { view.fetch(key, 'nothing sorry') }
|
212
|
-
|
213
|
-
it { is_expected.to eql('nothing sorry') }
|
214
|
-
|
215
|
-
it 'creates a dependency' do
|
216
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'creates a dependency with the right props' do
|
220
|
-
subject
|
221
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
222
|
-
|
223
|
-
expect(dep.props.attributes?).to eq(true)
|
224
|
-
|
225
|
-
expect(dep.props.raw_content?).to eq(false)
|
226
|
-
expect(dep.props.compiled_content?).to eq(false)
|
227
|
-
expect(dep.props.path?).to eq(false)
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
context 'with block' do
|
232
|
-
subject { view.fetch(key) { 'nothing sorry' } }
|
233
|
-
|
234
|
-
it { is_expected.to eql('nothing sorry') }
|
235
|
-
|
236
|
-
it 'creates a dependency' do
|
237
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
238
|
-
end
|
239
|
-
|
240
|
-
it 'creates a dependency with the right props' do
|
241
|
-
subject
|
242
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
243
|
-
|
244
|
-
expect(dep.props.attributes?).to eq(true)
|
245
|
-
|
246
|
-
expect(dep.props.raw_content?).to eq(false)
|
247
|
-
expect(dep.props.compiled_content?).to eq(false)
|
248
|
-
expect(dep.props.path?).to eq(false)
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
context 'with no fallback and no block' do
|
253
|
-
subject { view.fetch(key) }
|
254
|
-
|
255
|
-
it 'raises' do
|
256
|
-
expect { subject }.to raise_error(KeyError)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
describe '#key?' do
|
263
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
264
|
-
|
265
|
-
subject { view.key?(key) }
|
266
|
-
|
267
|
-
context 'with existant key' do
|
268
|
-
let(:key) { :animal }
|
269
|
-
|
270
|
-
it { is_expected.to eql(true) }
|
271
|
-
|
272
|
-
it 'creates a dependency' do
|
273
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
274
|
-
end
|
275
|
-
|
276
|
-
it 'creates a dependency with the right props' do
|
277
|
-
subject
|
278
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
279
|
-
|
280
|
-
expect(dep.props.attributes?).to eq(true)
|
281
|
-
|
282
|
-
expect(dep.props.raw_content?).to eq(false)
|
283
|
-
expect(dep.props.compiled_content?).to eq(false)
|
284
|
-
expect(dep.props.path?).to eq(false)
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
context 'with non-existant key' do
|
289
|
-
let(:key) { :weapon }
|
290
|
-
|
291
|
-
it { is_expected.to eql(false) }
|
292
|
-
|
293
|
-
it 'creates a dependency' do
|
294
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
295
|
-
end
|
296
|
-
|
297
|
-
it 'creates a dependency with the right props' do
|
298
|
-
subject
|
299
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
300
|
-
|
301
|
-
expect(dep.props.attributes?).to eq(true)
|
302
|
-
|
303
|
-
expect(dep.props.raw_content?).to eq(false)
|
304
|
-
expect(dep.props.compiled_content?).to eq(false)
|
305
|
-
expect(dep.props.path?).to eq(false)
|
306
|
-
end
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
describe '#hash' do
|
311
|
-
let(:document) { double(:document, identifier: '/foo') }
|
312
|
-
|
313
|
-
subject { view.hash }
|
314
|
-
|
315
|
-
it { should == described_class.hash ^ '/foo'.hash }
|
316
|
-
end
|
317
|
-
|
318
|
-
describe '#raw_content' do
|
319
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
320
|
-
|
321
|
-
subject { view.raw_content }
|
322
|
-
|
323
|
-
it { is_expected.to eql('stuff') }
|
324
|
-
|
325
|
-
it 'creates a dependency' do
|
326
|
-
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([document])
|
327
|
-
end
|
328
|
-
|
329
|
-
it 'creates a dependency with the right props' do
|
330
|
-
subject
|
331
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
332
|
-
|
333
|
-
expect(dep.props.raw_content?).to eq(true)
|
334
|
-
|
335
|
-
expect(dep.props.attributes?).to eq(false)
|
336
|
-
expect(dep.props.compiled_content?).to eq(false)
|
337
|
-
expect(dep.props.path?).to eq(false)
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|
@@ -1,277 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Needs :view_class
|
4
|
-
shared_examples 'an identifiable collection view' do
|
5
|
-
let(:view) { described_class.new(wrapped, view_context) }
|
6
|
-
|
7
|
-
let(:view_context) do
|
8
|
-
Nanoc::ViewContextForCompilation.new(
|
9
|
-
reps: Nanoc::Int::ItemRepRepo.new,
|
10
|
-
items: Nanoc::Int::ItemCollection.new(config),
|
11
|
-
dependency_tracker: dependency_tracker,
|
12
|
-
compilation_context: double(:__compilation_context),
|
13
|
-
snapshot_repo: double(:__snapshot_repo),
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:dependency_tracker) do
|
18
|
-
Nanoc::Int::DependencyTracker::Null.new
|
19
|
-
end
|
20
|
-
|
21
|
-
let(:config) do
|
22
|
-
{ string_pattern_type: 'glob' }
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#frozen?' do
|
26
|
-
let(:wrapped) do
|
27
|
-
collection_class.new(
|
28
|
-
config,
|
29
|
-
[
|
30
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
31
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
32
|
-
],
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
subject { view.frozen? }
|
37
|
-
|
38
|
-
context 'non-frozen collection' do
|
39
|
-
it { is_expected.to be(false) }
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'frozen collection' do
|
43
|
-
before do
|
44
|
-
wrapped.each { |o| expect(o).to receive(:freeze) }
|
45
|
-
wrapped.freeze
|
46
|
-
end
|
47
|
-
|
48
|
-
it { is_expected.to be(true) }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe '#unwrap' do
|
53
|
-
let(:wrapped) do
|
54
|
-
collection_class.new(
|
55
|
-
config,
|
56
|
-
[
|
57
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
58
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
59
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/baz')),
|
60
|
-
],
|
61
|
-
)
|
62
|
-
end
|
63
|
-
|
64
|
-
subject { view.unwrap }
|
65
|
-
|
66
|
-
it { should equal(wrapped) }
|
67
|
-
|
68
|
-
it 'does not create dependency' do
|
69
|
-
expect(dependency_tracker).not_to receive(:bounce)
|
70
|
-
subject
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe '#each' do
|
75
|
-
let(:wrapped) do
|
76
|
-
collection_class.new(
|
77
|
-
config,
|
78
|
-
[
|
79
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
80
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
81
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/baz')),
|
82
|
-
],
|
83
|
-
)
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'creates dependency' do
|
87
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: true)
|
88
|
-
view.each { |_i| }
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'returns self' do
|
92
|
-
expect(view.each { |_i| }).to equal(view)
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'yields elements with the right context' do
|
96
|
-
view.each { |v| expect(v._context).to equal(view_context) }
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe '#size' do
|
101
|
-
let(:wrapped) do
|
102
|
-
collection_class.new(
|
103
|
-
config,
|
104
|
-
[
|
105
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
106
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
107
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/baz')),
|
108
|
-
],
|
109
|
-
)
|
110
|
-
end
|
111
|
-
|
112
|
-
subject { view.size }
|
113
|
-
|
114
|
-
it 'creates dependency' do
|
115
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: true)
|
116
|
-
subject
|
117
|
-
end
|
118
|
-
|
119
|
-
it { should == 3 }
|
120
|
-
end
|
121
|
-
|
122
|
-
describe '#[]' do
|
123
|
-
let(:page_object) do
|
124
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/page.erb'))
|
125
|
-
end
|
126
|
-
|
127
|
-
let(:home_object) do
|
128
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/home.erb'))
|
129
|
-
end
|
130
|
-
|
131
|
-
let(:wrapped) do
|
132
|
-
collection_class.new(
|
133
|
-
config,
|
134
|
-
[
|
135
|
-
page_object,
|
136
|
-
home_object,
|
137
|
-
],
|
138
|
-
)
|
139
|
-
end
|
140
|
-
|
141
|
-
subject { view[arg] }
|
142
|
-
|
143
|
-
context 'no objects found' do
|
144
|
-
let(:arg) { '/donkey.*' }
|
145
|
-
it { is_expected.to equal(nil) }
|
146
|
-
|
147
|
-
it 'creates dependency' do
|
148
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: ['/donkey.*'])
|
149
|
-
subject
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
context 'string' do
|
154
|
-
let(:arg) { '/home.erb' }
|
155
|
-
|
156
|
-
it 'creates dependency' do
|
157
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: ['/home.erb'])
|
158
|
-
subject
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'returns wrapped object' do
|
162
|
-
expect(subject.class).to equal(view_class)
|
163
|
-
expect(subject.unwrap).to equal(home_object)
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'returns objects with right context' do
|
167
|
-
expect(subject._context).to equal(view_context)
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
context 'identifier' do
|
172
|
-
let(:arg) { Nanoc::Identifier.new('/home.erb') }
|
173
|
-
|
174
|
-
it 'creates dependency' do
|
175
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: ['/home.erb'])
|
176
|
-
subject
|
177
|
-
end
|
178
|
-
|
179
|
-
it 'returns wrapped object' do
|
180
|
-
expect(subject.class).to equal(view_class)
|
181
|
-
expect(subject.unwrap).to equal(home_object)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
context 'glob' do
|
186
|
-
let(:arg) { '/home.*' }
|
187
|
-
|
188
|
-
context 'globs not enabled' do
|
189
|
-
let(:config) { { string_pattern_type: 'legacy' } }
|
190
|
-
|
191
|
-
it 'creates dependency' do
|
192
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: ['/home.*'])
|
193
|
-
subject
|
194
|
-
end
|
195
|
-
|
196
|
-
it 'returns nil' do
|
197
|
-
expect(subject).to be_nil
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
context 'globs enabled' do
|
202
|
-
it 'creates dependency' do
|
203
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: ['/home.*'])
|
204
|
-
subject
|
205
|
-
end
|
206
|
-
|
207
|
-
it 'returns wrapped object' do
|
208
|
-
expect(subject.class).to equal(view_class)
|
209
|
-
expect(subject.unwrap).to equal(home_object)
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
context 'regex' do
|
215
|
-
let(:arg) { %r{\A/home} }
|
216
|
-
|
217
|
-
it 'creates dependency' do
|
218
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: [%r{\A/home}])
|
219
|
-
subject
|
220
|
-
end
|
221
|
-
|
222
|
-
it 'returns wrapped object' do
|
223
|
-
expect(subject.class).to equal(view_class)
|
224
|
-
expect(subject.unwrap).to equal(home_object)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
describe '#find_all' do
|
230
|
-
let(:wrapped) do
|
231
|
-
collection_class.new(
|
232
|
-
config,
|
233
|
-
[
|
234
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/about.css')),
|
235
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/about.md')),
|
236
|
-
double(:identifiable, identifier: Nanoc::Identifier.new('/style.css')),
|
237
|
-
],
|
238
|
-
)
|
239
|
-
end
|
240
|
-
|
241
|
-
subject { view.find_all(arg) }
|
242
|
-
|
243
|
-
context 'with string' do
|
244
|
-
let(:arg) { '/*.css' }
|
245
|
-
|
246
|
-
it 'creates dependency' do
|
247
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: ['/*.css'])
|
248
|
-
subject
|
249
|
-
end
|
250
|
-
|
251
|
-
it 'contains views' do
|
252
|
-
expect(subject.size).to eql(2)
|
253
|
-
about_css = subject.find { |iv| iv.identifier == '/about.css' }
|
254
|
-
style_css = subject.find { |iv| iv.identifier == '/style.css' }
|
255
|
-
expect(about_css.class).to equal(view_class)
|
256
|
-
expect(style_css.class).to equal(view_class)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
context 'with regex' do
|
261
|
-
let(:arg) { %r{\.css\z} }
|
262
|
-
|
263
|
-
it 'creates dependency' do
|
264
|
-
expect(dependency_tracker).to receive(:bounce).with(wrapped, raw_content: [%r{\.css\z}])
|
265
|
-
subject
|
266
|
-
end
|
267
|
-
|
268
|
-
it 'contains views' do
|
269
|
-
expect(subject.size).to eql(2)
|
270
|
-
about_css = subject.find { |iv| iv.identifier == '/about.css' }
|
271
|
-
style_css = subject.find { |iv| iv.identifier == '/style.css' }
|
272
|
-
expect(about_css.class).to equal(view_class)
|
273
|
-
expect(style_css.class).to equal(view_class)
|
274
|
-
end
|
275
|
-
end
|
276
|
-
end
|
277
|
-
end
|