Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
8ed78d06
Commit
8ed78d06
authored
Aug 21, 2013
by
Artūrs Mekšs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for model annotating with encoding comments
parent
c95ed52b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+24
-0
No files found.
spec/annotate/annotate_models_spec.rb
View file @
8ed78d06
...
...
@@ -345,6 +345,16 @@ end
Annotate
::
PATH_OPTIONS
.
each
{
|
key
|
ENV
[
key
.
to_s
]
=
''
}
end
def
encoding_comments_list_each
[
'# encoding: UTF-8'
,
'# coding: UTF-8'
,
'# -*- coding: UTF-8 -*-'
,
'#encoding: utf-8'
,
'# -*- encoding : utf-8 -*-'
].
each
{
|
encoding_comment
|
yield
encoding_comment
}
end
it
"should annotate the file before the model if position == 'before'"
do
annotate_one_file
:position
=>
"before"
File
.
read
(
@model_file_name
).
should
==
"
#{
@schema_info
}#{
@file_content
}
"
...
...
@@ -387,6 +397,20 @@ end
File
.
read
(
model_file_name
).
should
==
"
#{
schema_info
}#{
file_content
}
"
end
it
"should not touch encoding comments"
do
encoding_comments_list_each
do
|
encoding_comment
|
write_model
"user.rb"
,
<<-
EOS
#{
encoding_comment
}
class User < ActiveRecord::Base
end
EOS
annotate_one_file
:position
=>
:before
File
.
read
(
@model_file_name
).
should
==
"
#{
encoding_comment
}
\n
#{
@schema_info
}#{
@file_content
}
"
end
end
describe
"if a file can't be annotated"
do
before
do
write_model
(
'user.rb'
,
<<-
EOS
)
...
...
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