Adds organization model
This commit is contained in:
parent
a95a03c7e5
commit
b63f3fa7c9
5 changed files with 84 additions and 10 deletions
11
spec/factories/organizations.rb
Normal file
11
spec/factories/organizations.rb
Normal 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
|
||||
22
spec/models/organization_spec.rb
Normal file
22
spec/models/organization_spec.rb
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue