diff --git a/app/models/user.rb b/app/models/user.rb index d5911bbe7ef..ab946fe8069 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -28,7 +28,7 @@ class User < ActiveRecord::Base has_many :user_visits, dependent: :destroy has_many :invites, dependent: :destroy has_many :topic_links, dependent: :destroy - has_many :uploads, dependent: :destroy + has_many :uploads has_one :facebook_user_info, dependent: :destroy has_one :twitter_user_info, dependent: :destroy diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 0e0a1ad7ab6..7d4f62d30a3 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -3,26 +3,44 @@ require_dependency 'user' describe User do - it { should have_many :posts } - it { should have_many :notifications } - it { should have_many :topic_users } - it { should have_many :post_actions } - it { should have_many :user_actions } - it { should have_many :topics } - it { should have_many :user_open_ids } - it { should have_many :post_timings } - it { should have_many :email_tokens } - it { should have_many :views } - it { should have_many :user_visits } - it { should belong_to :approved_by } - it { should have_many :email_logs } - it { should have_many :topic_allowed_users } - it { should have_many :invites } + it { should have_many(:posts) } + it { should have_many(:notifications).dependent(:destroy) } + it { should have_many(:topic_users).dependent(:destroy) } + it { should have_many(:topics) } + it { should have_many(:user_open_ids).dependent(:destroy) } + it { should have_many(:user_actions).dependent(:destroy) } + it { should have_many(:post_actions).dependent(:destroy) } + it { should have_many(:email_logs).dependent(:destroy) } + it { should have_many(:post_timings) } + it { should have_many(:topic_allowed_users).dependent(:destroy) } + it { should have_many(:topics_allowed) } + it { should have_many(:email_tokens).dependent(:destroy) } + it { should have_many(:views) } + it { should have_many(:user_visits).dependent(:destroy) } + it { should have_many(:invites).dependent(:destroy) } + it { should have_many(:topic_links).dependent(:destroy) } + it { should have_many(:uploads) } + + it { should have_one(:facebook_user_info).dependent(:destroy) } + it { should have_one(:twitter_user_info).dependent(:destroy) } + it { should have_one(:github_user_info).dependent(:destroy) } + it { should have_one(:cas_user_info).dependent(:destroy) } + it { should have_one(:oauth2_user_info).dependent(:destroy) } + it { should have_one(:user_stat).dependent(:destroy) } + it { should belong_to(:approved_by) } + + it { should have_many(:group_users).dependent(:destroy) } + it { should have_many(:groups) } + it { should have_many(:secure_categories) } + + it { should have_one(:user_search_data).dependent(:destroy) } + it { should have_one(:api_key).dependent(:destroy) } + + it { should belong_to(:uploaded_avatar).dependent(:destroy) } it { should validate_presence_of :username } it { should validate_presence_of :email } - context '.enqueue_welcome_message' do let(:user) { Fabricate(:user) }