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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d82c59e5
Commit
d82c59e5
authored
Feb 21, 2020
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split up redactor shared examples
parent
d94f8a61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb
.../lib/banzai/filter/inline_metrics_redactor_filter_spec.rb
+4
-2
spec/support/shared_examples/banzai/filters/inline_metrics_redactor_shared_examples.rb
...banzai/filters/inline_metrics_redactor_shared_examples.rb
+4
-2
No files found.
spec/lib/banzai/filter/inline_metrics_redactor_filter_spec.rb
View file @
d82c59e5
...
...
@@ -19,12 +19,14 @@ describe Banzai::Filter::InlineMetricsRedactorFilter do
context
'with a metrics charts placeholder'
do
let
(
:input
)
{
%(<div class="js-render-metrics" data-dashboard-url="#{url}"></div>)
}
it_behaves_like
'a supported metrics dashboard url'
it_behaves_like
'redacts the embed placeholder'
it_behaves_like
'retains the embed placeholder when applicable'
context
'for a grafana dashboard'
do
let
(
:url
)
{
urls
.
project_grafana_api_metrics_dashboard_url
(
project
,
embedded:
true
)
}
it_behaves_like
'a supported metrics dashboard url'
it_behaves_like
'redacts the embed placeholder'
it_behaves_like
'retains the embed placeholder when applicable'
end
context
'the user has requisite permissions'
do
...
...
spec/support/shared_examples/banzai/filters/inline_metrics_redactor_shared_examples.rb
View file @
d82c59e5
# frozen_string_literal: true
RSpec
.
shared_examples
'
a supported metrics dashboard url
'
do
RSpec
.
shared_examples
'
redacts the embed placeholder
'
do
context
'no user is logged in'
do
it
'redacts the placeholder'
do
expect
(
doc
.
to_s
).
to
be_empty
...
...
@@ -14,7 +14,9 @@ RSpec.shared_examples 'a supported metrics dashboard url' do
expect
(
doc
.
to_s
).
to
be_empty
end
end
end
RSpec
.
shared_examples
'retains the embed placeholder when applicable'
do
context
'the user has requisite permissions'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:doc
)
{
filter
(
input
,
current_user:
user
)
}
...
...
@@ -22,7 +24,7 @@ RSpec.shared_examples 'a supported metrics dashboard url' do
it
'leaves the placeholder'
do
project
.
add_maintainer
(
user
)
expect
(
doc
.
to_s
).
to
eq
(
input
)
expect
(
CGI
.
unescapeHTML
(
doc
.
to_s
)
).
to
eq
(
input
)
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