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
Léo-Paul Géneau
gitlab-ce
Commits
2373082e
Commit
2373082e
authored
Dec 30, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create catch-all fixture generator for all static fixtures
parent
4cd962ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
spec/javascripts/fixtures/static_fixtures.rb
spec/javascripts/fixtures/static_fixtures.rb
+31
-0
No files found.
spec/javascripts/fixtures/static_fixtures.rb
0 → 100644
View file @
2373082e
require
'spec_helper'
describe
ApplicationController
,
'(Static JavaScript fixtures)'
,
type: :controller
do
include
JavaScriptFixturesHelpers
before
(
:all
)
do
clean_frontend_fixtures
(
'static/'
)
end
fixtures_path
=
File
.
expand_path
(
JavaScriptFixturesHelpers
::
FIXTURE_PATH
,
Rails
.
root
)
haml_fixtures
=
Dir
.
glob
(
File
.
expand_path
(
'**/*.haml'
,
fixtures_path
)).
map
do
|
file_path
|
file_path
.
sub
(
/\A
#{
fixtures_path
}#{
File
::
SEPARATOR
}
/
,
''
)
end
haml_fixtures
.
each
do
|
template_file_name
|
it
"static/
#{
template_file_name
.
sub
(
/\.haml\z/
,
'.raw'
)
}
"
do
|
example
|
fixture_file_name
=
example
.
description
rendered
=
render_template
(
template_file_name
)
store_frontend_fixture
(
rendered
,
fixture_file_name
)
end
end
private
def
render_template
(
template_file_name
)
fixture_path
=
JavaScriptFixturesHelpers
::
FIXTURE_PATH
controller
=
ApplicationController
.
new
controller
.
prepend_view_path
(
fixture_path
)
controller
.
render_to_string
(
template:
template_file_name
,
layout:
false
)
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