Sha256: c7493072664fc1795fd178803f3447c7c379968fcdff48c1b2ce3205de1e4112

Contents?: true

Size: 776 Bytes

Versions: 44

Compression:

Stored size: 776 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::ImmutableMap
    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

44 entries across 44 versions & 6 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/test_filter.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/test_filter.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/test/test_filter.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/temple-0.8.2/test/test_filter.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/temple-0.8.2/test/test_filter.rb
temple-0.9.0 test/test_filter.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/temple-0.8.0/test/test_filter.rb
temple-0.8.2 test/test_filter.rb
temple-0.8.1 test/test_filter.rb
brakeman-4.3.1 bundle/ruby/2.5.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/temple-0.7.7/test/test_filter.rb