Sha256: 1b4c302e981c8005e2b82ad39e1180a65c8d7b9d297fc01045a01c43ab3f9df9

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 Bytes

Contents

require 'spec_helper'
require 'byebug'

describe Mail2FrontMatter::PreProcessor, "registration" do

  let(:invalidly_defined_preprocessor) { 
    class MyInvalidProcessor < Mail2FrontMatter::PreProcessor
      # note, instanced not class
      def run(metadata, body)
        # some modification
        return metadata, body
      end
    end

    return MyInvalidProcessor
  }

  let(:validly_defined_preprocessor) { 
    class MyValidProcessor < Mail2FrontMatter::PreProcessor
      def self.run(metadata, body)
        # some modification
        return metadata, body
      end
    end

    return MyValidProcessor
  }

  it "should raise errors for invalid processors" do
    expect {
      invalidly_defined_preprocessor.register({})
    }.to raise_error
  end

  it "should not raise errors for valid processors" do
    expect {
      validly_defined_preprocessor.register({})
    }.to_not raise_error
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mail2frontmatter-0.0.4 spec/preprocessor_spec.rb
mail2frontmatter-0.0.3 spec/preprocessor_spec.rb
mail2frontmatter-0.0.2 spec/preprocessor_spec.rb