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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
f4e3ec29
Commit
f4e3ec29
authored
12 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed commit commenting
parent
3d7b35a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
7 deletions
+84
-7
app/models/key.rb
app/models/key.rb
+2
-1
app/models/note.rb
app/models/note.rb
+1
-0
db/migrate/20120121122616_fix_noteable_id.rb
db/migrate/20120121122616_fix_noteable_id.rb
+9
-0
db/schema.rb
db/schema.rb
+14
-2
spec/models/key_spec.rb
spec/models/key_spec.rb
+2
-1
spec/models/note_spec.rb
spec/models/note_spec.rb
+51
-3
spec/requests/commits_notes_spec.rb
spec/requests/commits_notes_spec.rb
+5
-0
No files found.
app/models/key.rb
View file @
f4e3ec29
...
...
@@ -55,11 +55,12 @@ end
# Table name: keys
#
# id :integer not null, primary key
# user_id :integer
not null
# user_id :integer
# created_at :datetime
# updated_at :datetime
# key :text
# title :string(255)
# identifier :string(255)
# project_id :integer
#
This diff is collapsed.
Click to expand it.
app/models/note.rb
View file @
f4e3ec29
...
...
@@ -88,5 +88,6 @@ end
# updated_at :datetime
# project_id :integer
# attachment :string(255)
# line_code :string(255)
#
This diff is collapsed.
Click to expand it.
db/migrate/20120121122616_fix_noteable_id.rb
0 → 100644
View file @
f4e3ec29
class
FixNoteableId
<
ActiveRecord
::
Migration
def
up
change_column
:notes
,
:noteable_id
,
:string
,
:limit
=>
255
end
def
down
change_column
:notes
,
:noteable_id
,
:integer
,
:limit
=>
11
end
end
This diff is collapsed.
Click to expand it.
db/schema.rb
View file @
f4e3ec29
...
...
@@ -11,7 +11,19 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
20120119203233
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
20120121122616
)
do
create_table
"features"
,
:force
=>
true
do
|
t
|
t
.
string
"name"
t
.
string
"branch_name"
t
.
integer
"assignee_id"
t
.
integer
"author_id"
t
.
integer
"project_id"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"version"
t
.
integer
"status"
,
:default
=>
0
,
:null
=>
false
end
create_table
"issues"
,
:force
=>
true
do
|
t
|
t
.
string
"title"
...
...
@@ -54,7 +66,7 @@ ActiveRecord::Schema.define(:version => 20120119203233) do
create_table
"notes"
,
:force
=>
true
do
|
t
|
t
.
text
"note"
t
.
integer
"noteable_id"
,
:limit
=>
255
t
.
string
"noteable_id"
t
.
string
"noteable_type"
t
.
integer
"author_id"
t
.
datetime
"created_at"
...
...
This diff is collapsed.
Click to expand it.
spec/models/key_spec.rb
View file @
f4e3ec29
...
...
@@ -22,11 +22,12 @@ end
# Table name: keys
#
# id :integer not null, primary key
# user_id :integer
not null
# user_id :integer
# created_at :datetime
# updated_at :datetime
# key :text
# title :string(255)
# identifier :string(255)
# project_id :integer
#
This diff is collapsed.
Click to expand it.
spec/models/note_spec.rb
View file @
f4e3ec29
require
'spec_helper'
describe
Note
do
let
(
:project
)
{
Factory
:project
}
let!
(
:commit
)
{
project
.
commit
}
describe
"Associations"
do
it
{
should
belong_to
(
:project
)
}
end
...
...
@@ -11,16 +14,60 @@ describe Note do
end
it
{
Factory
.
create
(
:note
,
:project
=>
Factory
.
create
(
:project
)
).
should
be_valid
}
:project
=>
project
).
should
be_valid
}
describe
"Scopes"
do
it
"should have a today named scope that returns ..."
do
Note
.
today
.
where_values
.
should
==
[
"created_at >= '
#{
Date
.
today
}
'"
]
end
end
describe
"Commit notes"
do
before
do
@note
=
Factory
:note
,
:project
=>
project
,
:noteable_id
=>
commit
.
id
,
:noteable_type
=>
"Commit"
end
it
"should save a valid note"
do
@note
.
noteable_id
.
should
==
commit
.
id
@note
.
target
.
id
.
should
==
commit
.
id
end
end
describe
"Pre-line commit notes"
do
before
do
@note
=
Factory
:note
,
:project
=>
project
,
:noteable_id
=>
commit
.
id
,
:noteable_type
=>
"Commit"
,
:line_code
=>
"OLD_1_23"
end
it
"should save a valid note"
do
@note
.
noteable_id
.
should
==
commit
.
id
@note
.
target
.
id
.
should
==
commit
.
id
end
it
{
@note
.
line_type_id
.
should
==
"OLD"
}
it
{
@note
.
line_file_id
.
should
==
1
}
it
{
@note
.
line_number
.
should
==
23
}
it
{
@note
.
for_line?
(
1
,
23
,
34
).
should
be_true
}
it
{
@note
.
for_line?
(
1
,
23
,
nil
).
should
be_true
}
it
{
@note
.
for_line?
(
1
,
23
,
0
).
should
be_true
}
it
{
@note
.
for_line?
(
1
,
23
,
23
).
should
be_true
}
it
{
@note
.
for_line?
(
1
,
nil
,
34
).
should
be_false
}
it
{
@note
.
for_line?
(
1
,
24
,
nil
).
should
be_false
}
it
{
@note
.
for_line?
(
1
,
24
,
0
).
should
be_false
}
it
{
@note
.
for_line?
(
1
,
24
,
23
).
should
be_false
}
end
describe
:authorization
do
before
do
@p1
=
Factory
:
project
@p1
=
project
@p2
=
Factory
:project
,
:code
=>
"alien"
,
:path
=>
"legit_1"
@u1
=
Factory
:user
@u2
=
Factory
:user
...
...
@@ -79,5 +126,6 @@ end
# updated_at :datetime
# project_id :integer
# attachment :string(255)
# line_code :string(255)
#
This diff is collapsed.
Click to expand it.
spec/requests/commits_notes_spec.rb
View file @
f4e3ec29
...
...
@@ -19,5 +19,10 @@ describe "Issues" do
it
"should conatin new note"
do
page
.
should
have_content
(
"I commented this commit"
)
end
it
"should be displayed when i visit this commit again"
do
visit
project_commit_path
(
project
,
commit
)
page
.
should
have_content
(
"I commented this commit"
)
end
end
end
This diff is collapsed.
Click to expand it.
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