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
Boxiang Sun
gitlab-ce
Commits
9a304721
Commit
9a304721
authored
Mar 19, 2018
by
haseeb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated integration test
parent
520c9371
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
spec/features/snippets/embedded_snippet_spec.rb
spec/features/snippets/embedded_snippet_spec.rb
+12
-13
No files found.
spec/features/snippets/embedded_snippet_spec.rb
View file @
9a304721
require
'spec_helper'
require
'spec_helper'
describe
'Embedded Snippets'
do
describe
'Embedded Snippets'
do
include
RSpec
::
Rails
::
RequestExampleGroup
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
,
file_name:
'popen.rb'
,
content:
content
)
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
,
file_name:
'popen.rb'
,
content:
content
)
}
let
(
:content
)
{
project
.
repository
.
blob_at
(
'master'
,
'files/ruby/popen.rb'
).
data
}
let
(
:content
)
{
project
.
repository
.
blob_at
(
'master'
,
'files/ruby/popen.rb'
).
data
}
after
do
FileUtils
.
rm_f
([
File
.
join
(
File
.
dirname
(
__FILE__
),
'embedded_snippet.html'
),
File
.
join
(
File
.
dirname
(
__FILE__
),
'snippet.js'
)])
end
it
'loads snippet'
,
:js
do
it
'loads snippet'
,
:js
do
get
"
#{
snippet_path
(
snippet
)
}
.js"
script_url
=
"http://
#{
Capybara
.
current_session
.
server
.
host
}
:
#{
Capybara
.
current_session
.
server
.
port
}
/
#{
snippet_path
(
snippet
,
format:
'js'
)
}
"
embed_body
=
"<html><body><script src=
\"
#{
script_url
}
\"
></script></body></html>"
File
.
write
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'snippet.js'
),
response
.
body
)
rack_app
=
proc
do
[
'200'
,
{
'Content-Type'
=>
'text/html'
},
[
embed_body
]]
end
s
cript_tag
=
"<html><body><script src=
\"
snippet.js
\"
></script></body></html>"
s
erver
=
Capybara
::
Server
.
new
(
rack_app
)
File
.
write
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'embedded_snippet.html'
),
script_tag
)
server
.
boot
Capybara
.
app
=
Rack
::
File
.
new
File
.
dirname
__FILE__
visit
(
"http://
#{
server
.
host
}
:
#{
server
.
port
}
/embedded_snippet.html"
)
visit
(
'embedded_snippet.html'
)
expect
(
page
).
to
have_content
(
"popen.rb"
)
expect
(
page
).
to
have_content
(
"popen.rb"
)
expect
(
page
).
to
have_content
(
"require 'fileutils'"
)
expect
(
page
).
to
have_content
(
"require 'fileutils'"
)
expect
(
page
).
to
have_link
(
'Open raw'
)
expect
(
page
).
to
have_link
(
'Download'
)
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