Skip to content

Instantly share code, notes, and snippets.

@dpickett
Created August 7, 2010 01:50
Show Gist options
  • Select an option

  • Save dpickett/512322 to your computer and use it in GitHub Desktop.

Select an option

Save dpickett/512322 to your computer and use it in GitHub Desktop.
describe "an email" do
it { should validate_presence_of :recipients }
it { should validate_presence_of :sender }
let(:recipient) { Factory.build(:user) }
let(:sender) { Factory.build(:sender) }
subject { Factory.build(:email, :recipients => [recipient], :sender => sender) }
describe "that is sent" do
subject { Factory.build(:sent_email, :recipients => [recipient]) }
its(:sent_at) { should_not be_nil }
end
describe "that is pending" do
subject { Factory.build(:pending_email, :recipients => [recipient]) }
its(:sent_at) { should be_nil }
end
describe "that has an invalid recipient" do
let(:recipient) { Factory.build(:user, :email => "something_invalid") }
it { should_not be_valid }
end
describe "that has an invalid sender" do
let(:sender) { Factory.build(:user, :email => "something_invalid") }
it { should_not be_valid }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment