Sha256: 99da74c4b33060c7a9a269215b7479e79e780a386e2d4612d36f49a65d697f87

Contents?: true

Size: 780 Bytes

Versions: 11

Compression:

Stored size: 780 Bytes

Contents

require 'helper'

class SimpleFilter < Temple::Filter
  define_options :key

  def on_test(arg)
    [:on_test, arg]
  end
end

describe Temple::Filter do
  it 'should support options' do
    Temple::Filter.should.respond_to :default_options
    Temple::Filter.should.respond_to :set_default_options
    Temple::Filter.should.respond_to :define_options
    Temple::Filter.new.options.should.be.instance_of Temple::ImmutableHash
    SimpleFilter.new(:key => 3).options[:key].should.equal 3
  end

  it 'should implement call' do
    Temple::Filter.new.call([:exp]).should.equal [:exp]
  end

  it 'should process expressions' do
    filter = SimpleFilter.new
    filter.call([:unhandled]).should.equal [:unhandled]
    filter.call([:test, 42]).should.equal [:on_test, 42]
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
temple-0.6.10 test/test_filter.rb
temple-0.6.9 test/test_filter.rb
temple-0.6.8 test/test_filter.rb
temple-0.6.7 test/test_filter.rb
temple-0.6.6 test/test_filter.rb
temple-0.6.5 test/test_filter.rb
temple-0.6.4 test/test_filter.rb
temple-0.6.3 test/test_filter.rb
temple-0.6.0 test/test_filter.rb
temple-0.5.5 test/test_filter.rb
temple-0.5.4 test/test_filter.rb