Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
aebb6294
Commit
aebb6294
authored
Nov 07, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for Timelog model.
parent
59fa8dca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
app/models/timelog.rb
app/models/timelog.rb
+2
-0
spec/factories/timelogs.rb
spec/factories/timelogs.rb
+8
-0
spec/models/timelog_spec.rb
spec/models/timelog_spec.rb
+10
-0
No files found.
app/models/timelog.rb
View file @
aebb6294
class
Timelog
<
ActiveRecord
::
Base
validates
:time_spent
,
:trackable
,
presence:
true
belongs_to
:trackable
,
polymorphic:
true
end
spec/factories/timelogs.rb
0 → 100644
View file @
aebb6294
# 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
spec/models/timelog_spec.rb
0 → 100644
View file @
aebb6294
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment