Adds organization model

This commit is contained in:
Gopesh Tulsyan 2014-06-05 16:27:51 +05:30
parent a95a03c7e5
commit b63f3fa7c9
5 changed files with 84 additions and 10 deletions

View file

@ -0,0 +1,11 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :organization do
name 'Example organization'
sequence(:email) { |n| "example#{n}@example.com" }
website_url 'www.esxample.com'
description 'Lorem Ipsum Dolor'
phone_number '900099009'
end
end

View file

@ -0,0 +1,22 @@
require 'spec_helper'
describe Organization do
describe 'validations' do
it 'has a valid factory' do
expect(build(:organization)).to be_valid
end
it 'is not valid without a name' do
should validate_presence_of(:name)
end
it 'is not valid without a website url' do
should validate_presence_of(:website_url)
end
it 'is not valid with a duplicate email' do
should validate_uniqueness_of(:email)
end
end
end