Sha256: e98b30b65dfb7acb4babbcd4b0877dc9e4f07a59cf595aa645c2e68a6bb38c57

Contents?: true

Size: 1.1 KB

Versions: 21

Compression:

Stored size: 1.1 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe ReaderNotifier do
  dataset :readers, :reader_layouts, :messages
  
  before do
    Radiant::Config['email.layout'] = 'email'
  end
    
  it "should have a radiant layout attribute" do
    ReaderNotifier.read_inheritable_attribute(:default_layout).should_not be_nil
  end

  it "should render a supplied message" do
    message = ReaderNotifier.create_message(readers(:normal), messages(:normal))
    message.to.should == [readers(:normal).email]
    message.from.should == ["admin@www.example.com"]
    message.body.should =~ /#{messages(:normal).filtered_body}/
    message.content_type.should == 'text/html'
  end
  
  it "should render messages with layout" do
    message = ReaderNotifier.create_message(readers(:normal), messages(:normal))
    message.body.should =~ /<head>/
  end
  
  it "should render radius tags within a message" do
    message = ReaderNotifier.create_message(readers(:normal), messages(:taggy))
    message.body.should =~ /<title>#{messages(:taggy).subject}<\/title>/
    message.body.should =~ /To #{readers(:normal).name}/
  end
  
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
radiant-reader-extension-1.0.0 spec/models/reader_notifier_spec.rb