introduce organizations
This commit is contained in:
parent
008ccf8b6d
commit
a06dc84eb0
9 changed files with 67 additions and 3 deletions
0
spec/controllers/organizations_controller_spec.rb
Normal file
0
spec/controllers/organizations_controller_spec.rb
Normal file
13
spec/factories/organizations.rb
Normal file
13
spec/factories/organizations.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FactoryGirl.define do
|
||||
factory :organization do
|
||||
name { Faker::Company.name }
|
||||
description { Faker::Lorem.paragraph }
|
||||
|
||||
# after(:create) do |organization|
|
||||
# File.open("spec/support/logos/#{1 + rand(13)}.png") do |file|
|
||||
# organization.picture = file
|
||||
# end
|
||||
# organization.save!
|
||||
# end
|
||||
end
|
||||
end
|
||||
20
spec/models/organization_spec.rb
Normal file
20
spec/models/organization_spec.rb
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Organization do
|
||||
let(:organization) { create(:organization) }
|
||||
|
||||
describe 'validation' 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
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
it { should have_many(:conferences).dependent(:destroy) }
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue