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
iv
gitlab-ce
Commits
54b04f1c
Commit
54b04f1c
authored
Aug 20, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fixture_file helper.
parent
ac268674
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
29 deletions
+16
-29
spec/lib/gitlab/email/attachment_uploader_spec.rb
spec/lib/gitlab/email/attachment_uploader_spec.rb
+1
-7
spec/lib/gitlab/email/receiver_spec.rb
spec/lib/gitlab/email/receiver_spec.rb
+0
-6
spec/lib/gitlab/email/reply_parser_spec.rb
spec/lib/gitlab/email/reply_parser_spec.rb
+0
-6
spec/lib/gitlab/google_code_import/client_spec.rb
spec/lib/gitlab/google_code_import/client_spec.rb
+1
-1
spec/lib/gitlab/google_code_import/importer_spec.rb
spec/lib/gitlab/google_code_import/importer_spec.rb
+1
-1
spec/support/fixture_helpers.rb
spec/support/fixture_helpers.rb
+11
-0
spec/support/markdown_feature.rb
spec/support/markdown_feature.rb
+2
-2
spec/workers/email_receiver_worker_spec.rb
spec/workers/email_receiver_worker_spec.rb
+0
-6
No files found.
spec/lib/gitlab/email/attachment_uploader_spec.rb
View file @
54b04f1c
require
"spec_helper"
describe
Gitlab
::
Email
::
AttachmentUploader
do
def
fixture_file
(
filename
)
return
''
if
filename
.
blank?
file_path
=
File
.
expand_path
(
Rails
.
root
+
'spec/fixtures/'
+
filename
)
File
.
read
(
file_path
)
end
describe
"#execute"
do
let
(
:project
)
{
build
(
:project
)
}
let
(
:message_raw
)
{
fixture_file
(
"emails/attachment.eml"
)
}
let
(
:message
)
{
Mail
::
Message
.
new
(
message_raw
)
}
it
"
creates a post with an attachment
"
do
it
"
uploads all attachments and returns their links
"
do
links
=
described_class
.
new
(
message
).
execute
(
project
)
link
=
links
.
first
...
...
spec/lib/gitlab/email/receiver_spec.rb
View file @
54b04f1c
require
"spec_helper"
describe
Gitlab
::
Email
::
Receiver
do
def
fixture_file
(
filename
)
return
''
if
filename
.
blank?
file_path
=
File
.
expand_path
(
Rails
.
root
+
'spec/fixtures/'
+
filename
)
File
.
read
(
file_path
)
end
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:address
).
and_return
(
"reply+%{reply_key}@appmail.adventuretime.ooo"
)
...
...
spec/lib/gitlab/email/reply_parser_spec.rb
View file @
54b04f1c
...
...
@@ -2,12 +2,6 @@ require "spec_helper"
# Inspired in great part by Discourse's Email::Receiver
describe
Gitlab
::
Email
::
ReplyParser
do
def
fixture_file
(
filename
)
return
''
if
filename
.
blank?
file_path
=
File
.
expand_path
(
Rails
.
root
+
'spec/fixtures/'
+
filename
)
File
.
read
(
file_path
)
end
describe
'#execute'
do
def
test_parse_body
(
mail_string
)
described_class
.
new
(
Mail
::
Message
.
new
(
mail_string
)).
execute
...
...
spec/lib/gitlab/google_code_import/client_spec.rb
View file @
54b04f1c
require
"spec_helper"
describe
Gitlab
::
GoogleCodeImport
::
Client
do
let
(
:raw_data
)
{
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
"spec/fixtures/GoogleCodeProjectHosting.json"
)
))
}
let
(
:raw_data
)
{
JSON
.
parse
(
fixture_file
(
"GoogleCodeProjectHosting.json"
))
}
subject
{
described_class
.
new
(
raw_data
)
}
describe
"#valid?"
do
...
...
spec/lib/gitlab/google_code_import/importer_spec.rb
View file @
54b04f1c
...
...
@@ -2,7 +2,7 @@ require "spec_helper"
describe
Gitlab
::
GoogleCodeImport
::
Importer
do
let
(
:mapped_user
)
{
create
(
:user
,
username:
"thilo123"
)
}
let
(
:raw_data
)
{
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
"spec/fixtures/GoogleCodeProjectHosting.json"
)
))
}
let
(
:raw_data
)
{
JSON
.
parse
(
fixture_file
(
"GoogleCodeProjectHosting.json"
))
}
let
(
:client
)
{
Gitlab
::
GoogleCodeImport
::
Client
.
new
(
raw_data
)
}
let
(
:import_data
)
do
{
...
...
spec/support/fixture_helpers.rb
0 → 100644
View file @
54b04f1c
module
FixtureHelpers
def
fixture_file
(
filename
)
return
''
if
filename
.
blank?
file_path
=
File
.
expand_path
(
Rails
.
root
.
join
(
'spec/fixtures/'
,
filename
))
File
.
read
(
file_path
)
end
end
RSpec
.
configure
do
|
config
|
config
.
include
FixtureHelpers
end
spec/support/markdown_feature.rb
View file @
54b04f1c
...
...
@@ -100,7 +100,7 @@ class MarkdownFeature
end
def
raw_markdown
fixture
=
Rails
.
root
.
join
(
'spec/fixtures/
markdown.md.erb'
)
ERB
.
new
(
File
.
read
(
fixture
)
).
result
(
binding
)
markdown
=
fixture_file
(
'
markdown.md.erb'
)
ERB
.
new
(
markdown
).
result
(
binding
)
end
end
spec/workers/email_receiver_worker_spec.rb
View file @
54b04f1c
require
"spec_helper"
describe
EmailReceiverWorker
do
def
fixture_file
(
filename
)
return
''
if
filename
.
blank?
file_path
=
File
.
expand_path
(
Rails
.
root
+
'spec/fixtures/'
+
filename
)
File
.
read
(
file_path
)
end
let
(
:raw_message
)
{
fixture_file
(
'emails/valid_reply.eml'
)
}
context
"when reply by email is enabled"
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