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,686 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Nanoc::Int::Executor do
|
4
|
-
let(:executor) { described_class.new(rep, compilation_context, dependency_tracker) }
|
5
|
-
|
6
|
-
let(:compilation_context) do
|
7
|
-
Nanoc::Int::CompilationContext.new(
|
8
|
-
action_provider: action_provider,
|
9
|
-
reps: reps,
|
10
|
-
site: site,
|
11
|
-
compiled_content_cache: compiled_content_cache,
|
12
|
-
snapshot_repo: snapshot_repo,
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:item) { Nanoc::Int::Item.new(content, {}, '/index.md') }
|
17
|
-
let(:rep) { Nanoc::Int::ItemRep.new(item, :donkey) }
|
18
|
-
let(:content) { Nanoc::Int::TextualContent.new('Donkey Power').tap(&:freeze) }
|
19
|
-
|
20
|
-
let(:action_provider) { double(:action_provider) }
|
21
|
-
let(:reps) { double(:reps) }
|
22
|
-
let(:site) { double(:site) }
|
23
|
-
let(:compiled_content_cache) { double(:compiled_content_cache) }
|
24
|
-
let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
|
25
|
-
|
26
|
-
let(:dependency_tracker) { Nanoc::Int::DependencyTracker.new(double(:dependency_store)) }
|
27
|
-
|
28
|
-
describe '#filter' do
|
29
|
-
let(:assigns) { {} }
|
30
|
-
|
31
|
-
let(:content) { Nanoc::Int::TextualContent.new('<%= "Donkey" %> Power') }
|
32
|
-
|
33
|
-
before do
|
34
|
-
allow(compilation_context).to receive(:assigns_for) { assigns }
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'normal flow with textual rep' do
|
38
|
-
subject { executor.filter(:erb) }
|
39
|
-
|
40
|
-
before do
|
41
|
-
expect(Nanoc::Int::NotificationCenter)
|
42
|
-
.to receive(:post).with(:filtering_started, rep, :erb)
|
43
|
-
expect(Nanoc::Int::NotificationCenter)
|
44
|
-
.to receive(:post).with(:filtering_ended, rep, :erb)
|
45
|
-
|
46
|
-
snapshot_repo.set(rep, :last, content)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'does not set :pre on rep' do
|
50
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
51
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'does not set :post on rep' do
|
55
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
56
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'updates :last on rep' do
|
60
|
-
expect { subject }
|
61
|
-
.to change { snapshot_repo.get(rep, :last).string }
|
62
|
-
.from('<%= "Donkey" %> Power')
|
63
|
-
.to('Donkey Power')
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'does not set :pre in repo' do
|
67
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
68
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'does not set :post in repo' do
|
72
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
73
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'updates :last in repo' do
|
77
|
-
expect { subject }
|
78
|
-
.to change { snapshot_repo.get(rep, :last).string }
|
79
|
-
.from('<%= "Donkey" %> Power')
|
80
|
-
.to('Donkey Power')
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'returns frozen data' do
|
84
|
-
executor.filter(:erb)
|
85
|
-
|
86
|
-
expect(snapshot_repo.get(rep, :last)).to be_frozen
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'normal flow with binary rep' do
|
91
|
-
subject { executor.filter(:whatever) }
|
92
|
-
|
93
|
-
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('foo.dat')) }
|
94
|
-
|
95
|
-
before do
|
96
|
-
expect(Nanoc::Int::NotificationCenter)
|
97
|
-
.to receive(:post).with(:filtering_started, rep, :whatever)
|
98
|
-
expect(Nanoc::Int::NotificationCenter)
|
99
|
-
.to receive(:post).with(:filtering_ended, rep, :whatever)
|
100
|
-
|
101
|
-
File.write(content.filename, 'Foo Data')
|
102
|
-
|
103
|
-
filter_class = Class.new(::Nanoc::Filter) do
|
104
|
-
type :binary
|
105
|
-
|
106
|
-
def run(filename, _params = {})
|
107
|
-
File.write(output_filename, "Compiled data for #{filename}")
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
expect(Nanoc::Filter).to receive(:named).with(:whatever) { filter_class }
|
112
|
-
|
113
|
-
snapshot_repo.set(rep, :last, content)
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'does not set :pre on rep' do
|
117
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
118
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'does not set :post on rep' do
|
122
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
123
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'updates :last on rep' do
|
127
|
-
expect { subject }
|
128
|
-
.to change { snapshot_repo.get(rep, :last) }
|
129
|
-
.from(some_binary_content('Foo Data'))
|
130
|
-
.to(some_binary_content(/\ACompiled data for \/.*\/foo.dat\z/))
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'does not set :pre in repo' do
|
134
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
135
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'does not set :post in repo' do
|
139
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
140
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'updates :last in repo' do
|
144
|
-
expect { subject }
|
145
|
-
.to change { File.read(snapshot_repo.get(rep, :last).filename) }
|
146
|
-
.from('Foo Data')
|
147
|
-
.to(/\ACompiled data for \/.*\/foo.dat\z/)
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'returns frozen data' do
|
151
|
-
executor.filter(:whatever)
|
152
|
-
|
153
|
-
expect(snapshot_repo.get(rep, :last)).to be_frozen
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
context 'normal flow with binary rep and binary-to-text filter' do
|
158
|
-
subject { executor.filter(:whatever) }
|
159
|
-
|
160
|
-
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('foo.dat')) }
|
161
|
-
|
162
|
-
before do
|
163
|
-
expect(Nanoc::Int::NotificationCenter)
|
164
|
-
.to receive(:post).with(:filtering_started, rep, :whatever)
|
165
|
-
expect(Nanoc::Int::NotificationCenter)
|
166
|
-
.to receive(:post).with(:filtering_ended, rep, :whatever)
|
167
|
-
|
168
|
-
File.write(content.filename, 'Foo Data')
|
169
|
-
|
170
|
-
filter_class = Class.new(::Nanoc::Filter) do
|
171
|
-
type binary: :text
|
172
|
-
|
173
|
-
def run(filename, _params = {})
|
174
|
-
"Compiled data for #{filename}"
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
expect(Nanoc::Filter).to receive(:named).with(:whatever) { filter_class }
|
179
|
-
|
180
|
-
snapshot_repo.set(rep, :last, content)
|
181
|
-
end
|
182
|
-
|
183
|
-
it 'does not set :pre on rep' do
|
184
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
185
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'does not set :post on rep' do
|
189
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
190
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'updates :last on rep' do
|
194
|
-
expect { subject }
|
195
|
-
.to change { snapshot_repo.get(rep, :last) }
|
196
|
-
.from(some_binary_content('Foo Data'))
|
197
|
-
.to(some_textual_content(/\ACompiled data for \/.*\/foo.dat\z/))
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'does not set :pre in repo' do
|
201
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
202
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'does not set :post in repo' do
|
206
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
207
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'updates :last in repo' do
|
211
|
-
expect { subject }
|
212
|
-
.to change { snapshot_repo.get(rep, :last) }
|
213
|
-
.from(some_binary_content('Foo Data'))
|
214
|
-
.to(some_textual_content(/\ACompiled data for \/.*\/foo.dat\z/))
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
context 'normal flow with textual rep and text-to-binary filter' do
|
219
|
-
subject { executor.filter(:whatever) }
|
220
|
-
|
221
|
-
before do
|
222
|
-
expect(Nanoc::Int::NotificationCenter)
|
223
|
-
.to receive(:post).with(:filtering_started, rep, :whatever)
|
224
|
-
expect(Nanoc::Int::NotificationCenter)
|
225
|
-
.to receive(:post).with(:filtering_ended, rep, :whatever)
|
226
|
-
|
227
|
-
filter_class = Class.new(::Nanoc::Filter) do
|
228
|
-
type text: :binary
|
229
|
-
|
230
|
-
def run(content, _params = {})
|
231
|
-
File.write(output_filename, "Binary #{content}")
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
expect(Nanoc::Filter).to receive(:named).with(:whatever) { filter_class }
|
236
|
-
|
237
|
-
snapshot_repo.set(rep, :last, content)
|
238
|
-
end
|
239
|
-
|
240
|
-
it 'does not set :pre on rep' do
|
241
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
242
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'does not set :post on rep' do
|
246
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
247
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
248
|
-
end
|
249
|
-
|
250
|
-
it 'updates :last on rep' do
|
251
|
-
expect { subject }
|
252
|
-
.to change { snapshot_repo.get(rep, :last) }
|
253
|
-
.from(some_textual_content('<%= "Donkey" %> Power'))
|
254
|
-
.to(some_binary_content('Binary <%= "Donkey" %> Power'))
|
255
|
-
end
|
256
|
-
|
257
|
-
it 'does not set :pre in repo' do
|
258
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
259
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :pre) }
|
260
|
-
end
|
261
|
-
|
262
|
-
it 'does not set :post in repo' do
|
263
|
-
expect(snapshot_repo.get(rep, :post)).to be_nil
|
264
|
-
expect { subject }.not_to change { snapshot_repo.get(rep, :post) }
|
265
|
-
end
|
266
|
-
|
267
|
-
it 'updates :last in repo' do
|
268
|
-
expect { subject }
|
269
|
-
.to change { snapshot_repo.get(rep, :last) }
|
270
|
-
.from(some_textual_content('<%= "Donkey" %> Power'))
|
271
|
-
.to(some_binary_content('Binary <%= "Donkey" %> Power'))
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
context 'non-existant filter' do
|
276
|
-
it 'raises' do
|
277
|
-
expect { executor.filter(:ajlsdfjklaskldfj) }
|
278
|
-
.to raise_error(Nanoc::Int::Errors::UnknownFilter)
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
context 'non-binary rep, binary-to-something filter' do
|
283
|
-
before do
|
284
|
-
filter_class = Class.new(::Nanoc::Filter) do
|
285
|
-
type :binary
|
286
|
-
|
287
|
-
def run(_content, _params = {}); end
|
288
|
-
end
|
289
|
-
|
290
|
-
expect(Nanoc::Filter).to receive(:named).with(:whatever) { filter_class }
|
291
|
-
|
292
|
-
snapshot_repo.set(rep, :last, content)
|
293
|
-
end
|
294
|
-
|
295
|
-
it 'raises' do
|
296
|
-
expect { executor.filter(:whatever) }
|
297
|
-
.to raise_error(Nanoc::Int::Errors::CannotUseBinaryFilter)
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
context 'binary rep, text-to-something filter' do
|
302
|
-
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('foo.md')) }
|
303
|
-
|
304
|
-
before do
|
305
|
-
snapshot_repo.set(rep, :last, content)
|
306
|
-
end
|
307
|
-
|
308
|
-
it 'raises' do
|
309
|
-
expect { executor.filter(:erb) }
|
310
|
-
.to raise_error(Nanoc::Int::Errors::CannotUseTextualFilter)
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
context 'binary filter that does not write anything' do
|
315
|
-
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('foo.dat')) }
|
316
|
-
|
317
|
-
before do
|
318
|
-
expect(Nanoc::Int::NotificationCenter)
|
319
|
-
.to receive(:post).with(:filtering_started, rep, :whatever)
|
320
|
-
expect(Nanoc::Int::NotificationCenter)
|
321
|
-
.to receive(:post).with(:filtering_ended, rep, :whatever)
|
322
|
-
|
323
|
-
File.write(content.filename, 'Foo Data')
|
324
|
-
|
325
|
-
filter_class = Class.new(::Nanoc::Filter) do
|
326
|
-
type :binary
|
327
|
-
|
328
|
-
def run(_filename, _params = {}); end
|
329
|
-
end
|
330
|
-
|
331
|
-
snapshot_repo.set(rep, :last, content)
|
332
|
-
|
333
|
-
expect(Nanoc::Filter).to receive(:named).with(:whatever) { filter_class }
|
334
|
-
end
|
335
|
-
|
336
|
-
example do
|
337
|
-
expect { executor.filter(:whatever) }
|
338
|
-
.to raise_error(Nanoc::Int::Executor::OutputNotWrittenError)
|
339
|
-
end
|
340
|
-
end
|
341
|
-
|
342
|
-
context 'content is frozen' do
|
343
|
-
before do
|
344
|
-
snapshot_repo.set(rep, :last, item.content)
|
345
|
-
end
|
346
|
-
|
347
|
-
let(:item) do
|
348
|
-
Nanoc::Int::Item.new('foo bar', {}, '/foo.md').tap(&:freeze)
|
349
|
-
end
|
350
|
-
|
351
|
-
let(:filter_that_modifies_content) do
|
352
|
-
Class.new(::Nanoc::Filter) do
|
353
|
-
def run(content, _params = {})
|
354
|
-
content.gsub!('foo', 'moo')
|
355
|
-
content
|
356
|
-
end
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
let(:filter_that_modifies_params) do
|
361
|
-
Class.new(::Nanoc::Filter) do
|
362
|
-
def run(_content, params = {})
|
363
|
-
params[:foo] = 'bar'
|
364
|
-
'asdf'
|
365
|
-
end
|
366
|
-
end
|
367
|
-
end
|
368
|
-
|
369
|
-
it 'errors when attempting to modify content' do
|
370
|
-
expect(Nanoc::Filter).to receive(:named).with(:whatever).and_return(filter_that_modifies_content)
|
371
|
-
expect { executor.filter(:whatever) }.to raise_frozen_error
|
372
|
-
end
|
373
|
-
|
374
|
-
it 'receives frozen filter args' do
|
375
|
-
expect(Nanoc::Filter).to receive(:named).with(:whatever).and_return(filter_that_modifies_params)
|
376
|
-
expect { executor.filter(:whatever) }.to raise_frozen_error
|
377
|
-
end
|
378
|
-
end
|
379
|
-
end
|
380
|
-
|
381
|
-
describe '#layout' do
|
382
|
-
let(:site) { double(:site, config: config, layouts: layouts) }
|
383
|
-
|
384
|
-
let(:config) do
|
385
|
-
{
|
386
|
-
string_pattern_type: 'glob',
|
387
|
-
}
|
388
|
-
end
|
389
|
-
|
390
|
-
let(:layout) do
|
391
|
-
Nanoc::Int::Layout.new(layout_content, { bug: 'Gum Emperor' }, '/default.erb')
|
392
|
-
end
|
393
|
-
|
394
|
-
let(:layouts) { [layout] }
|
395
|
-
|
396
|
-
let(:layout_content) { 'head <%= @foo %> foot' }
|
397
|
-
|
398
|
-
let(:assigns) do
|
399
|
-
{ foo: 'hallo' }
|
400
|
-
end
|
401
|
-
|
402
|
-
let(:view_context) do
|
403
|
-
Nanoc::ViewContextForCompilation.new(
|
404
|
-
reps: Nanoc::Int::ItemRepRepo.new,
|
405
|
-
items: Nanoc::Int::ItemCollection.new(config),
|
406
|
-
dependency_tracker: dependency_tracker,
|
407
|
-
compilation_context: double(:compilation_context),
|
408
|
-
snapshot_repo: snapshot_repo,
|
409
|
-
)
|
410
|
-
end
|
411
|
-
|
412
|
-
let(:action_sequence) do
|
413
|
-
Nanoc::Int::ActionSequence.build(rep) do |b|
|
414
|
-
b.add_filter(:erb, {})
|
415
|
-
end
|
416
|
-
end
|
417
|
-
|
418
|
-
before do
|
419
|
-
rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(:pre, binary: false)]
|
420
|
-
|
421
|
-
snapshot_repo.set(rep, :last, content)
|
422
|
-
|
423
|
-
allow(compilation_context).to receive(:site) { site }
|
424
|
-
allow(compilation_context).to receive(:assigns_for).with(rep, dependency_tracker) { assigns }
|
425
|
-
allow(compilation_context).to receive(:create_view_context).with(dependency_tracker).and_return(view_context)
|
426
|
-
|
427
|
-
allow(action_provider).to receive(:action_sequence_for).with(layout).and_return(action_sequence)
|
428
|
-
end
|
429
|
-
|
430
|
-
subject { executor.layout('/default.*') }
|
431
|
-
|
432
|
-
context 'accessing layout attributes' do
|
433
|
-
let(:layout_content) { 'head <%= @layout[:bug] %> foot' }
|
434
|
-
|
435
|
-
it 'exposes @layout as view' do
|
436
|
-
allow(dependency_tracker).to receive(:enter)
|
437
|
-
.with(layout, raw_content: true, attributes: false, compiled_content: false, path: false)
|
438
|
-
allow(dependency_tracker).to receive(:enter)
|
439
|
-
.with(layout, raw_content: false, attributes: [:bug], compiled_content: false, path: false)
|
440
|
-
allow(dependency_tracker).to receive(:exit)
|
441
|
-
subject
|
442
|
-
expect(snapshot_repo.get(rep, :last).string).to eq('head Gum Emperor foot')
|
443
|
-
end
|
444
|
-
end
|
445
|
-
|
446
|
-
context 'normal flow' do
|
447
|
-
it 'updates :last on rep' do
|
448
|
-
expect { subject }
|
449
|
-
.to change { snapshot_repo.get(rep, :last) }
|
450
|
-
.from(some_textual_content('Donkey Power'))
|
451
|
-
.to(some_textual_content('head hallo foot'))
|
452
|
-
end
|
453
|
-
|
454
|
-
it 'updates :last in repo' do
|
455
|
-
expect { subject }
|
456
|
-
.to change { snapshot_repo.get(rep, :last) }
|
457
|
-
.from(some_textual_content('Donkey Power'))
|
458
|
-
.to(some_textual_content('head hallo foot'))
|
459
|
-
end
|
460
|
-
|
461
|
-
it 'sets frozen content' do
|
462
|
-
subject
|
463
|
-
expect(snapshot_repo.get(rep, :last)).to be_frozen
|
464
|
-
expect(snapshot_repo.get(rep, :pre)).to be_frozen
|
465
|
-
end
|
466
|
-
|
467
|
-
it 'does not create pre snapshot' do
|
468
|
-
# a #layout is followed by a #snapshot(:pre, …)
|
469
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
470
|
-
subject
|
471
|
-
expect(snapshot_repo.get(rep, :pre)).to be_nil
|
472
|
-
end
|
473
|
-
|
474
|
-
it 'sends notifications' do
|
475
|
-
expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:filtering_started, rep, :erb).ordered
|
476
|
-
expect(Nanoc::Int::NotificationCenter).to receive(:post).with(:filtering_ended, rep, :erb).ordered
|
477
|
-
|
478
|
-
subject
|
479
|
-
end
|
480
|
-
|
481
|
-
context 'compiled_content reference in layout' do
|
482
|
-
let(:layout_content) { 'head <%= @item_rep.compiled_content(snapshot: :pre) %> foot' }
|
483
|
-
|
484
|
-
let(:assigns) do
|
485
|
-
{ item_rep: Nanoc::CompilationItemRepView.new(rep, view_context) }
|
486
|
-
end
|
487
|
-
|
488
|
-
before do
|
489
|
-
executor.snapshot(:pre)
|
490
|
-
end
|
491
|
-
|
492
|
-
it 'updates :last on rep' do
|
493
|
-
expect { subject }
|
494
|
-
.to change { snapshot_repo.get(rep, :last) }
|
495
|
-
.from(some_textual_content('Donkey Power'))
|
496
|
-
.to(some_textual_content('head Donkey Power foot'))
|
497
|
-
end
|
498
|
-
|
499
|
-
it 'updates :last in repo' do
|
500
|
-
expect { subject }
|
501
|
-
.to change { snapshot_repo.get(rep, :last) }
|
502
|
-
.from(some_textual_content('Donkey Power'))
|
503
|
-
.to(some_textual_content('head Donkey Power foot'))
|
504
|
-
end
|
505
|
-
end
|
506
|
-
|
507
|
-
context 'content with layout reference' do
|
508
|
-
let(:layout_content) { 'head <%= @layout.identifier %> foot' }
|
509
|
-
|
510
|
-
it 'updates :last on rep' do
|
511
|
-
expect { subject }
|
512
|
-
.to change { snapshot_repo.get(rep, :last) }
|
513
|
-
.from(some_textual_content('Donkey Power'))
|
514
|
-
.to(some_textual_content('head /default.erb foot'))
|
515
|
-
end
|
516
|
-
|
517
|
-
it 'updates :last in repo' do
|
518
|
-
expect { subject }
|
519
|
-
.to change { snapshot_repo.get(rep, :last) }
|
520
|
-
.from(some_textual_content('Donkey Power'))
|
521
|
-
.to(some_textual_content('head /default.erb foot'))
|
522
|
-
end
|
523
|
-
end
|
524
|
-
end
|
525
|
-
|
526
|
-
context 'no layout found' do
|
527
|
-
let(:layouts) do
|
528
|
-
[Nanoc::Int::Layout.new('head <%= @foo %> foot', {}, '/other.erb')]
|
529
|
-
end
|
530
|
-
|
531
|
-
it 'raises' do
|
532
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::UnknownLayout)
|
533
|
-
end
|
534
|
-
end
|
535
|
-
|
536
|
-
context 'no filter specified' do
|
537
|
-
let(:action_sequence) do
|
538
|
-
Nanoc::Int::ActionSequence.new(rep)
|
539
|
-
end
|
540
|
-
|
541
|
-
it 'raises' do
|
542
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::UndefinedFilterForLayout)
|
543
|
-
end
|
544
|
-
end
|
545
|
-
|
546
|
-
context 'binary item' do
|
547
|
-
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('donkey.md')) }
|
548
|
-
|
549
|
-
it 'raises' do
|
550
|
-
expect { subject }.to raise_error(
|
551
|
-
Nanoc::Int::Errors::CannotLayoutBinaryItem,
|
552
|
-
'The “/index.md” item (rep “donkey”) cannot be laid out because it is a binary item. If you are getting this error for an item that should be textual instead of binary, make sure that its extension is included in the text_extensions array in the site configuration.',
|
553
|
-
)
|
554
|
-
end
|
555
|
-
end
|
556
|
-
|
557
|
-
it 'receives frozen filter args' do
|
558
|
-
filter_class = Class.new(::Nanoc::Filter) do
|
559
|
-
def run(_content, params = {})
|
560
|
-
params[:foo] = 'bar'
|
561
|
-
'asdf'
|
562
|
-
end
|
563
|
-
end
|
564
|
-
|
565
|
-
expect(Nanoc::Filter).to receive(:named).with(:erb) { filter_class }
|
566
|
-
|
567
|
-
expect { subject }.to raise_frozen_error
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
|
-
describe '#snapshot' do
|
572
|
-
subject { executor.snapshot(:something) }
|
573
|
-
|
574
|
-
before do
|
575
|
-
snapshot_repo.set(rep, :last, content)
|
576
|
-
|
577
|
-
File.write('donkey.dat', 'binary donkey')
|
578
|
-
end
|
579
|
-
|
580
|
-
context 'binary content' do
|
581
|
-
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('donkey.dat')) }
|
582
|
-
|
583
|
-
it 'creates snapshots on rep' do
|
584
|
-
expect { subject }
|
585
|
-
.to change { snapshot_repo.get(rep, :something) }
|
586
|
-
.from(nil)
|
587
|
-
.to(some_binary_content('binary donkey'))
|
588
|
-
end
|
589
|
-
|
590
|
-
it 'creates snapshots in repo' do
|
591
|
-
expect { subject }
|
592
|
-
.to change { snapshot_repo.get(rep, :something) }
|
593
|
-
.from(nil)
|
594
|
-
.to(some_binary_content('binary donkey'))
|
595
|
-
end
|
596
|
-
end
|
597
|
-
|
598
|
-
context 'textual content' do
|
599
|
-
let(:content) { Nanoc::Int::TextualContent.new('Donkey Power') }
|
600
|
-
|
601
|
-
it 'creates snapshots on rep' do
|
602
|
-
expect { subject }
|
603
|
-
.to change { snapshot_repo.get(rep, :something) }
|
604
|
-
.from(nil)
|
605
|
-
.to(some_textual_content('Donkey Power'))
|
606
|
-
end
|
607
|
-
|
608
|
-
it 'creates snapshots in repo' do
|
609
|
-
expect { subject }
|
610
|
-
.to change { snapshot_repo.get(rep, :something) }
|
611
|
-
.from(nil)
|
612
|
-
.to(some_textual_content('Donkey Power'))
|
613
|
-
end
|
614
|
-
end
|
615
|
-
|
616
|
-
context 'final snapshot' do
|
617
|
-
let(:content) { Nanoc::Int::TextualContent.new('Donkey Power') }
|
618
|
-
|
619
|
-
context 'raw path' do
|
620
|
-
before do
|
621
|
-
rep.raw_paths = { something: ['output/donkey.md'] }
|
622
|
-
end
|
623
|
-
|
624
|
-
it 'does not write' do
|
625
|
-
executor.snapshot(:something)
|
626
|
-
|
627
|
-
expect(File.file?('output/donkey.md')).not_to be
|
628
|
-
end
|
629
|
-
end
|
630
|
-
|
631
|
-
context 'no raw path' do
|
632
|
-
it 'does not write' do
|
633
|
-
executor.snapshot(:something)
|
634
|
-
|
635
|
-
expect(File.file?('output/donkey.md')).to eq(false)
|
636
|
-
end
|
637
|
-
end
|
638
|
-
end
|
639
|
-
end
|
640
|
-
|
641
|
-
describe '#find_layout' do
|
642
|
-
let(:site) { double(:site, config: config, layouts: layouts) }
|
643
|
-
|
644
|
-
let(:config) { {} }
|
645
|
-
|
646
|
-
before do
|
647
|
-
allow(compilation_context).to receive(:site) { site }
|
648
|
-
end
|
649
|
-
|
650
|
-
subject { executor.find_layout(arg) }
|
651
|
-
|
652
|
-
context 'layout with cleaned identifier exists' do
|
653
|
-
let(:arg) { '/default' }
|
654
|
-
|
655
|
-
let(:layouts) do
|
656
|
-
[Nanoc::Int::Layout.new('head <%= @foo %> foot', {}, Nanoc::Identifier.new('/default/', type: :legacy))]
|
657
|
-
end
|
658
|
-
|
659
|
-
it { is_expected.to eq(layouts[0]) }
|
660
|
-
end
|
661
|
-
|
662
|
-
context 'no layout with cleaned identifier exists' do
|
663
|
-
let(:layouts) do
|
664
|
-
[Nanoc::Int::Layout.new('head <%= @foo %> foot', {}, '/default.erb')]
|
665
|
-
end
|
666
|
-
|
667
|
-
context 'globs' do
|
668
|
-
let(:config) { { string_pattern_type: 'glob' } }
|
669
|
-
|
670
|
-
let(:arg) { '/default.*' }
|
671
|
-
|
672
|
-
it { is_expected.to eq(layouts[0]) }
|
673
|
-
end
|
674
|
-
|
675
|
-
context 'no globs' do
|
676
|
-
let(:config) { { string_pattern_type: 'legacy' } }
|
677
|
-
|
678
|
-
let(:arg) { '/default.*' }
|
679
|
-
|
680
|
-
it 'raises' do
|
681
|
-
expect { subject }.to raise_error(Nanoc::Int::Errors::UnknownLayout)
|
682
|
-
end
|
683
|
-
end
|
684
|
-
end
|
685
|
-
end
|
686
|
-
end
|