Sha256: 2caedd2b6b8a09d3567d7756852585a74aea101cf4276f78a11ad87e037b6f24
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' require 'parslet/rig/rspec' require 'pp' class MyPresenter def self.for :quote end def initialize(attributes, content, additional_attributes) @attributes = attributes @content = content @additional_attributes = additional_attributes end def content @content end def attributes @additional_attributes || { title: "my custom title" } end end describe Shortcode::Presenter do let(:simple_quote) { load_fixture :simple_quote } let(:presenter_output) { load_fixture :simple_quote_presenter_output, :html } let(:attributes_output) { load_fixture :simple_quote_presenter_attributes_output, :html } describe "using a custom presenter" do before do Shortcode.register_presenter MyPresenter end it "uses the custom attributes" do Shortcode.process(simple_quote).gsub("\n",'').should == presenter_output.gsub("\n",'') end it "passes through additional attributes" do Shortcode.process(simple_quote, { title: 'Additional attribute title' }).gsub("\n",'').should == attributes_output.gsub("\n",'') end end end
Version data entries
5 entries across 5 versions & 1 rubygems