Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
122 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,39 @@ | ||
describe Nanoc::Filter do | ||
describe '.define' do | ||
before do | ||
Nanoc::Filter.define(:nanoc_filter_define_sample) do |content, _params| | ||
content.upcase | ||
context 'simple filter' do | ||
let(:filter_name) { 'b5355bbb4d772b9853d21be57da614dba521dbbb' } | ||
let(:filter_class) { Nanoc::Filter.named(filter_name) } | ||
|
||
before do | ||
Nanoc::Filter.define(filter_name) do |content, _params| | ||
content.upcase | ||
end | ||
end | ||
end | ||
|
||
it 'defines a filter' do | ||
expect(Nanoc::Filter.named(:nanoc_filter_define_sample)).not_to be_nil | ||
it 'defines a filter' do | ||
expect(filter_class).not_to be_nil | ||
end | ||
|
||
it 'defines a callable filter' do | ||
expect(filter_class.new.run('foo', {})).to eql('FOO') | ||
end | ||
end | ||
|
||
it 'defines a callable filter' do | ||
expect(Nanoc::Filter.named(:nanoc_filter_define_sample).new.run('foo', {})).to eql('FOO') | ||
context 'filter that accesses assigns' do | ||
let(:filter_name) { 'd7ed105d460e99a3d38f46af023d9490c140fdd9' } | ||
let(:filter_class) { Nanoc::Filter.named(filter_name) } | ||
let(:filter) { filter_class.new(assigns) } | ||
let(:assigns) { { animal: 'Giraffe' } } | ||
|
||
before do | ||
Nanoc::Filter.define(filter_name) do |_content, _params| | ||
@animal | ||
end | ||
end | ||
|
||
it 'can access assigns' do | ||
expect(filter.setup_and_run(:__irrelevant__, {})).to eq('Giraffe') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
describe Nanoc::Int::PluginRegistry do | ||
describe '.identifier(s)' do | ||
let(:identifier) { :ce79f6b8ddb22233e9aaf7d8f011689492acf02f } | ||
|
||
context 'direct subclass' do | ||
example do | ||
klass = | ||
Class.new(Nanoc::Filter) do | ||
identifier :plugin_registry_spec | ||
end | ||
|
||
expect(klass.identifier).to eql(:plugin_registry_spec) | ||
end | ||
end | ||
|
||
context 'indirect subclass' do | ||
example do | ||
superclass = Class.new(Nanoc::Filter) | ||
|
||
klass = | ||
Class.new(superclass) do | ||
identifier :plugin_registry_spec | ||
end | ||
|
||
expect(klass.identifier).to eql(:plugin_registry_spec) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe 'GH-928', site: true, stdio: true do | ||
example do | ||
expect { Nanoc::CLI.run(%w(check --list)) }.to output(%r{^ css$}).to_stdout | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters