summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-02-12 11:17:42 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-02-20 12:10:26 -0200
commit41d8f5649e3c8a1e37be4608fd03153005c3fa58 (patch)
tree1a76ece3e4bab3327539f4417d911d3656444212 /spec/models
parent040ae7e3e0c6f4d97fe6366bff9b05831283db7e (diff)
downloadgitlab-ce-41d8f5649e3c8a1e37be4608fd03153005c3fa58.tar.gz
Add task model
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/task_spec.rb32
-rw-r--r--spec/models/user_spec.rb1
2 files changed, 33 insertions, 0 deletions
diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb
new file mode 100644
index 00000000000..950d9b74196
--- /dev/null
+++ b/spec/models/task_spec.rb
@@ -0,0 +1,32 @@
+# == Schema Information
+#
+# Table name: tasks
+#
+# id :integer not null, primary key
+# user_id :integer not null
+# project_id :integer not null
+# target_id :integer not null
+# target_type :string not null
+# author_id :integer
+# action :integer
+# state :string not null
+# created_at :datetime
+# updated_at :datetime
+#
+
+require 'spec_helper'
+
+describe Task, models: true do
+ describe 'relationships' do
+ it { is_expected.to belong_to(:author).class_name("User") }
+ it { is_expected.to belong_to(:project) }
+ it { is_expected.to belong_to(:target).touch(true) }
+ it { is_expected.to belong_to(:user) }
+ end
+
+ describe 'validations' do
+ it { is_expected.to validate_presence_of(:action) }
+ it { is_expected.to validate_presence_of(:target) }
+ it { is_expected.to validate_presence_of(:user) }
+ end
+end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 47ce409fe4b..d2769836526 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -92,6 +92,7 @@ describe User, models: true do
it { is_expected.to have_many(:identities).dependent(:destroy) }
it { is_expected.to have_one(:abuse_report) }
it { is_expected.to have_many(:spam_logs).dependent(:destroy) }
+ it { is_expected.to have_many(:tasks).dependent(:destroy) }
end
describe 'validations' do