tool_spec.rb revision 202a3a7faf5c855c5a2582548b6de26ec44a6b5f
require 'spec_helper'
describe Tool do
context 'Migrations' do
%w( name description url ).each do |column|
it { should have_db_column(column).of_type(:text) }
end
it { should have_db_index(:name).unique(true) }
end
context 'Validations' do
['http://example.com/', 'https://example.com/', 'file://path/to/file'].
each do |val|
it { should allow_value(val).for :url }
end
[nil, '', 'fooo'].each do |val|
it { should_not allow_value(val).for :url }
end
end
end