2010-05-02 23:33:17 +00:00
|
|
|
require 'spec_helper'
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-02 23:33:17 +00:00
|
|
|
describe Snippet do
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-02 23:33:17 +00:00
|
|
|
it 'should have a valid factory' do
|
|
|
|
Factory.build(:snippet).should be_valid
|
|
|
|
end
|
2010-08-21 22:48:24 +00:00
|
|
|
|
|
|
|
# Validations ##
|
|
|
|
|
|
|
|
%w{site name template}.each do |field|
|
|
|
|
it "should validate presence of #{field}" do
|
|
|
|
template = Factory.build(:snippet, field.to_sym => nil)
|
|
|
|
template.should_not be_valid
|
|
|
|
template.errors[field.to_sym].should == ["can't be blank"]
|
|
|
|
end
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
|
|
|
end
|