Created
May 6, 2012 01:40
-
-
Save halan/2606933 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| devise :database_authenticatable, :registerable, | |
| :recoverable, :rememberable, :trackable, :validatable | |
| attr_accessible :email, :password, :password_confirmation, :remember_me | |
| belongs_to :account, :polymorphic => true | |
| def realstater? | |
| account.kind_of? Realstater | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe User do | |
| context 'when I have a user with realstater account' do | |
| let(:realstater) { create :realstater } | |
| subject { create :user, :account => realstater } | |
| its(:realstater?) { should be_true } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment