-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #484 from knu/liquid-to_uri
Add a new Liquid filter `to_uri`.
- Loading branch information
Showing
4 changed files
with
107 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'spec_helper' | ||
|
||
describe LiquidDroppable do | ||
before do | ||
class DroppableTest | ||
include LiquidDroppable | ||
|
||
def initialize(value) | ||
@value = value | ||
end | ||
|
||
attr_reader :value | ||
|
||
def to_s | ||
"[value:#{value}]" | ||
end | ||
end | ||
|
||
class DroppableTestDrop | ||
def value | ||
@object.value | ||
end | ||
end | ||
end | ||
|
||
describe 'test class' do | ||
it 'should be droppable' do | ||
five = DroppableTest.new(5) | ||
five.to_liquid.class.should == DroppableTestDrop | ||
Liquid::Template.parse('{{ x.value | plus:3 }}').render('x' => five).should == '8' | ||
Liquid::Template.parse('{{ x }}').render('x' => five).should == '[value:5]' | ||
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