gitlab-org--gitlab-foss/spec/models/task_spec.rb
Douglas Barbosa Alexandre 7cafa2ce92 Add tasks queue list page
2016-02-20 12:10:26 -02:00

55 lines
1.5 KiB
Ruby

# == 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 'respond to' do
it { is_expected.to respond_to(:author_name) }
it { is_expected.to respond_to(:author_email) }
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
describe '#action_name' do
it 'returns assigned when action is assigned' do
subject.action = Task::ASSIGNED
expect(subject.action_name).to eq 'assigned'
end
end
describe '#body?' do
it 'returns true when target respond to title'
it 'returns false when target does not respond to title'
end
describe '#target_iid' do
it 'returns target.iid when target respond to iid'
it 'returns target_id when target does not respond to iid'
end
end