task_test.rb revision 203159cca3f0cedf0b074655613eebafec4db98f
require 'test_helper'
class TaskTest < ActiveSupport::TestCase
context 'Migrations' do
%w( name description ).each do |column|
should have_db_column(column).of_type(:string)
end
should have_db_index(:name).unique(true)
end
context 'Validations' do
context 'when no name is taken' do
should allow_value('foo').for :name
end
context 'when name is already taken' do
setup do
Task.create!(:name => 'foo')
end
should_not allow_value('foo').for :name
end
end
end