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
b2fbd90a
Commit
b2fbd90a
authored
Jan 14, 2015
by
capripot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update spec to support file with dir
parent
41d13a25
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+5
-6
No files found.
spec/annotate/annotate_models_spec.rb
100644 → 100755
View file @
b2fbd90a
...
@@ -136,9 +136,8 @@ EOS
...
@@ -136,9 +136,8 @@ EOS
# todo: use 'files' gem instead
# todo: use 'files' gem instead
def
create
(
file
,
body
=
"hi"
)
def
create
(
file
,
body
=
"hi"
)
file_path
=
File
.
join
(
AnnotateModels
.
model_dir
,
file
)
file_path
=
File
.
join
(
AnnotateModels
.
model_dir
[
0
]
,
file
)
FileUtils
.
mkdir_p
(
File
.
dirname
(
file_path
))
FileUtils
.
mkdir_p
(
File
.
dirname
(
file_path
))
File
.
open
(
file_path
,
"wb"
)
do
|
f
|
File
.
open
(
file_path
,
"wb"
)
do
|
f
|
f
.
puts
(
body
)
f
.
puts
(
body
)
end
end
...
@@ -146,7 +145,7 @@ EOS
...
@@ -146,7 +145,7 @@ EOS
end
end
def
check_class_name
(
file
,
class_name
)
def
check_class_name
(
file
,
class_name
)
klass
=
AnnotateModels
.
get_model_class
(
file
)
klass
=
AnnotateModels
.
get_model_class
(
File
.
join
(
AnnotateModels
.
model_dir
[
0
],
file
)
)
expect
(
klass
).
not_to
eq
(
nil
)
expect
(
klass
).
not_to
eq
(
nil
)
expect
(
klass
.
name
).
to
eq
(
class_name
)
expect
(
klass
.
name
).
to
eq
(
class_name
)
...
@@ -294,7 +293,7 @@ EOS
...
@@ -294,7 +293,7 @@ EOS
CONSTANT = 1
CONSTANT = 1
end
end
EOS
EOS
path
=
File
.
expand_path
(
"
#{
AnnotateModels
.
model_dir
}
/loaded_class"
)
path
=
File
.
expand_path
(
'loaded_class'
,
AnnotateModels
.
model_dir
[
0
]
)
Kernel
.
load
"
#{
path
}
.rb"
Kernel
.
load
"
#{
path
}
.rb"
expect
(
Kernel
).
not_to
receive
(
:require
).
with
(
path
)
expect
(
Kernel
).
not_to
receive
(
:require
).
with
(
path
)
...
@@ -557,7 +556,7 @@ end
...
@@ -557,7 +556,7 @@ end
it
"displays an error message"
do
it
"displays an error message"
do
expect
(
capturing
(
:stdout
)
{
expect
(
capturing
(
:stdout
)
{
AnnotateModels
.
do_annotations
:model_dir
=>
@model_dir
,
:is_rake
=>
true
AnnotateModels
.
do_annotations
:model_dir
=>
@model_dir
,
:is_rake
=>
true
}).
to
include
(
"Unable to annotate user.rb: oops"
)
}).
to
include
(
"Unable to annotate
#{
@model_dir
}
/
user.rb: oops"
)
end
end
it
"displays the full stack trace with --trace"
do
it
"displays the full stack trace with --trace"
do
...
@@ -587,7 +586,7 @@ end
...
@@ -587,7 +586,7 @@ end
it
"displays an error message"
do
it
"displays an error message"
do
expect
(
capturing
(
:stdout
)
{
expect
(
capturing
(
:stdout
)
{
AnnotateModels
.
remove_annotations
:model_dir
=>
@model_dir
,
:is_rake
=>
true
AnnotateModels
.
remove_annotations
:model_dir
=>
@model_dir
,
:is_rake
=>
true
}).
to
include
(
"Unable to deannotate user.rb: oops"
)
}).
to
include
(
"Unable to deannotate
#{
@model_dir
}
/
user.rb: oops"
)
end
end
it
"displays the full stack trace"
do
it
"displays the full stack trace"
do
...
...
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