Skip to content

Instantly share code, notes, and snippets.

@mhfs
Created October 30, 2009 20:09
Show Gist options
  • Select an option

  • Save mhfs/222668 to your computer and use it in GitHub Desktop.

Select an option

Save mhfs/222668 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/../spec_helper'
describe Mailing do
fixtures :mailings
it "should have some fixtures loaded" do
Mailing.should have(3).records
end
it { should belong_to :account }
it { should have_many :deliveries, :dependent => :destroy }
it { should validate_presence_of :account_id }
it { should validate_presence_of :subject }
it { should validate_presence_of :content }
it { should have_default_scope :order => :subject }
it { should have_scope :recent, :limit => 5, :order => :created_at }
context "with mixed textile and html content" do
before(:each) do
@m = Mailing.new
@m.content = "<b>p. Enviatore</b>"
end
it "should clear tags from content on validation" do
@m.valid?
@m.content.should == "p. Enviatore"
end
it "should strip html and parse textile when parsed_content is called" do
@m.parsed_content.should == "<p>Enviatore</p>"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment