Skip to content

Instantly share code, notes, and snippets.

@MattHall
Created November 6, 2011 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattHall/1342797 to your computer and use it in GitHub Desktop.
Save MattHall/1342797 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe NewsletterSubscriber do
describe "validations" do
before(:each) do
NewsletterSubscriber.create(:email => "test@example.com")
end
it { should validate_presence_of(:email) }
it { should validate_uniqueness_of(:email) }
end
describe "confirmation token" do
it "should be created when the subscriber is created" do
@subscriber = NewsletterSubscriber.create(:email => "test@example.com")
@subscriber.reload
@subscriber.confirmation_token.should_not be_blank
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment