Skip to content

Instantly share code, notes, and snippets.

@halan
Created May 6, 2012 01:40
Show Gist options
  • Select an option

  • Save halan/2606933 to your computer and use it in GitHub Desktop.

Select an option

Save halan/2606933 to your computer and use it in GitHub Desktop.
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
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