Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
96ed6419
Commit
96ed6419
authored
Apr 30, 2014
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Spec] Added ErrorReport spec
parent
28a2e290
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
error_report_spec.rb
spec/unit/user_interface/error_report_spec.rb
+93
-0
No files found.
spec/unit/user_interface/error_report_spec.rb
0 → 100644
View file @
96ed6419
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
module
Pod
describe
UserInterface
::
ErrorReport
do
def
remove_color
(
string
)
string
.
gsub
(
/\e\[(\d+)m/
,
''
)
end
describe
'In general'
do
before
do
@exception
=
Informative
.
exception
(
'at - (~/code.rb):'
)
@exception
.
stubs
(
:backtrace
).
returns
([
'Line 1'
,
'Line 2'
])
@report
=
UserInterface
::
ErrorReport
end
it
'returns a well-structured report'
do
expected
=
<<-
EOS
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
```
CocoaPods :
#{
Pod
::
VERSION
}
Ruby :
#{
RUBY_DESCRIPTION
}
RubyGems :
#{
Gem
::
VERSION
}
Host : :host_information
Xcode : :xcode_information
Ruby lib dir :
#{
RbConfig
::
CONFIG
[
'libdir'
]
}
Repositories : repo_1
repo_2
```
### Podfile
```ruby
```
### Error
```
Pod::Informative - [!] at - (~/code.rb):
Line 1
Line 2
```
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing github issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%1B%5B31m%5B%21%5D+at+-%1B%5B0m&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Don't forget to anonymize any private data!
EOS
@report
.
stubs
(
:markdown_podfile
).
returns
<<-
EOS
### Podfile
```ruby
```
EOS
@report
.
stubs
(
:host_information
).
returns
(
':host_information'
)
@report
.
stubs
(
:xcode_information
).
returns
(
':xcode_information'
)
@report
.
stubs
(
:repo_information
).
returns
([
'repo_1'
,
'repo_2'
])
report
=
remove_color
(
@report
.
report
(
@exception
))
report
.
should
==
expected
end
it
'strips the local path from the exception message'
do
message
=
@report
.
pathless_exception_message
(
@exception
.
message
)
message
=
remove_color
(
message
)
message
.
should
==
'[!] at -'
end
end
end
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