Sha256: 9bad5a085201cf43af6c68e49ce01d32b74113fbd1e0eb6112f39bdaa3295796

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

require 'assert'
require 'inbox-sync/config/filter'

module InboxSync

  class ConfigFilterTests < Assert::Context
    before do
      @filter = InboxSync::Config::Filter.new({
        :subject => 'test',
        :from => /kellyredding.com\Z/
      })
    end
    subject { @filter }

    should have_reader :conditions, :actions
    should have_instance_method :match?

    should "convert condition values to regexs if not" do
      assert_kind_of Hash, subject.conditions
      subject.conditions.each do |k,v|
        assert_kind_of Regexp, v
      end
    end

    should "know if it matches a message" do
      assert subject.match?(test_mail_item.message)
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inbox-sync-0.4.1 test/config/filter_test.rb
inbox-sync-0.4.0 test/config/filter_test.rb
inbox-sync-0.3.0 test/config/filter_test.rb