Sha256: c57ee27f834300968b7507da795e23c66b718fb3206bf945e26cd5158d6d2b49

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

require 'spec_helper'
require 'parslet/rig/rspec'
require 'pp'

class MyPrsenter

  def self.for
    :quote
  end

  def initialize(attributes, content)
    @attributes = attributes
    @content = content
  end

  def content
    @content
  end

  def attributes
    { title: "my custom title" }
  end
end

describe Shortcode::Presenter do

  let(:simple_quote)        { load_fixture :simple_quote }
  let(:simple_quote_output) { load_fixture :simple_quote_presenter_output, :html }

  describe "using a custom presenter" do

    before do
      Shortcode.register_presenter MyPrsenter
    end

    it "uses the custome attributes" do
      Shortcode.process(simple_quote).gsub("\n",'').should == simple_quote_output.gsub("\n",'')
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shortcode-0.1.2 spec/presenter_spec.rb
shortcode-0.1.1 spec/presenter_spec.rb
shortcode-0.1.0 spec/presenter_spec.rb