Commit aebb6294 authored by Ruben Davila's avatar Ruben Davila

Add specs for Timelog model.

parent 59fa8dca
class Timelog < ActiveRecord::Base
validates :time_spent, :trackable, presence: true
belongs_to :trackable, polymorphic: true
end
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :timelog do
time_spent 3600
association :trackable, factory: :issue
end
end
require 'rails_helper'
RSpec.describe Timelog, type: :model do
subject { build(:timelog) }
it { is_expected.to be_valid }
it { is_expected.to validate_presence_of(:time_spent) }
it { is_expected.to validate_presence_of(:trackable) }
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment