Skip to content

Instantly share code, notes, and snippets.

@Ch4s3
Created November 6, 2014 14:37
Show Gist options
  • Save Ch4s3/08b882cf85b3c994631d to your computer and use it in GitHub Desktop.
Save Ch4s3/08b882cf85b3c994631d to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe User do
it { should validate_presence_of(:password) }
it { should belong_to :organization }
it { should ensure_inclusion_of(:type).in_array(User.descendants.map(&:name)) }
describe "factory" do
subject { FactoryGirl.build :user }
before { FactoryGirl.create :user }
it { should be_valid }
end
describe "doctor" do
subject { FactoryGirl.build :doctor }
before { FactoryGirl.create :doctor }
it { should be_valid }
end
describe "admin" do
subject { FactoryGirl.build :admin_user }
before { FactoryGirl.create :admin_user }
it { should be_valid }
end
describe "root" do
subject { FactoryGirl.build :root_user }
before { FactoryGirl.create :root_user }
it { should be_valid }
end
describe "#root" do
subject { described_class.new.root? }
it { should be_false }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment