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
Tatuya Kamada
gitlab-ce
Commits
4cd962ec
Commit
4cd962ec
authored
Dec 30, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow storage of raw string fixtures
parent
313aa339
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
spec/support/javascript_fixtures_helpers.rb
spec/support/javascript_fixtures_helpers.rb
+15
-3
No files found.
spec/support/javascript_fixtures_helpers.rb
View file @
4cd962ec
...
@@ -20,11 +20,24 @@ module JavaScriptFixturesHelpers
...
@@ -20,11 +20,24 @@ module JavaScriptFixturesHelpers
# Public: Store a response object as fixture file
# Public: Store a response object as fixture file
#
#
# response - response object to store
# response -
string or
response object to store
# fixture_file_name - file name to store the fixture in (relative to FIXTURE_PATH)
# fixture_file_name - file name to store the fixture in (relative to FIXTURE_PATH)
#
#
def
store_frontend_fixture
(
response
,
fixture_file_name
)
def
store_frontend_fixture
(
response
,
fixture_file_name
)
fixture_file_name
=
File
.
expand_path
(
fixture_file_name
,
FIXTURE_PATH
)
fixture_file_name
=
File
.
expand_path
(
fixture_file_name
,
FIXTURE_PATH
)
fixture
=
response
.
respond_to?
(
:body
)
?
parse_response
(
response
)
:
response
FileUtils
.
mkdir_p
(
File
.
dirname
(
fixture_file_name
))
File
.
write
(
fixture_file_name
,
fixture
)
end
private
# Private: Prepare a response object for use as a frontend fixture
#
# response - response object to prepare
#
def
parse_response
(
response
)
fixture
=
response
.
body
fixture
=
response
.
body
response_mime_type
=
Mime
::
Type
.
lookup
(
response
.
content_type
)
response_mime_type
=
Mime
::
Type
.
lookup
(
response
.
content_type
)
...
@@ -44,7 +57,6 @@ module JavaScriptFixturesHelpers
...
@@ -44,7 +57,6 @@ module JavaScriptFixturesHelpers
fixture
.
gsub!
(
%r{="/}
,
"=
\"
http://
#{
test_host
}
/"
)
fixture
.
gsub!
(
%r{="/}
,
"=
\"
http://
#{
test_host
}
/"
)
end
end
FileUtils
.
mkdir_p
(
File
.
dirname
(
fixture_file_name
))
fixture
File
.
write
(
fixture_file_name
,
fixture
)
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