Sha256: de8e30851cb3db135cba04e8ed08fa52236b1d1a3d70ab1980ebec9b85ad250c

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
 
describe Locomotive::Liquid::Filters::Misc do
  
  include Locomotive::Liquid::Filters::Misc
  
  it 'should underscore an input' do
    underscore('foo').should == 'foo'
    underscore('home page').should == 'home_page'
    underscore('My foo Bar').should == 'my_foo_bar'
    underscore('foo/bar').should == 'foo_bar'
    underscore('foo/bar/index').should == 'foo_bar_index'
  end
  
  it 'should dasherize an input' do
    dasherize('foo').should == 'foo'
    dasherize('foo_bar').should == 'foo-bar'
    dasherize('foo/bar').should == 'foo-bar'
    dasherize('foo/bar/index').should == 'foo-bar-index'
  end
  
  it 'should concat strings' do
    concat('foo', 'bar').should == 'foobar'
    concat('hello', 'foo', 'bar').should == 'hellofoobar'
  end
  
  it 'should return the input string every n occurences' do
    modulo('foo', 0, 3).should == ''
    modulo('foo', 1, 3).should == ''
    modulo('foo', 2, 3).should == 'foo'
    modulo('foo', 3, 3).should == ''
    modulo('foo', 4, 3).should == ''
    modulo('foo', 5, 3).should == 'foo'
  end
    
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotive_cms-0.0.3.3 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.3.1 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.9 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.8 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.7 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.6 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.5 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.4 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.3 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.2 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2.1 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.2 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.1.4 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.1.3 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.1.2 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.1.1 spec/lib/locomotive/liquid/filters/misc_spec.rb
locomotive_cms-0.0.1 spec/lib/locomotive/liquid/filters/misc_spec.rb