File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 66module Phlex
77 module Sinatra
88 Error = Class . new ( StandardError )
9- IncompatibleOptionError = Class . new ( Error )
9+ ArgumentError = Class . new ( Error )
1010
1111 class TypeError < Error
1212 MAX_SIZE = 32
@@ -47,6 +47,10 @@ def phlex(
4747 )
4848 raise Phlex ::Sinatra ::TypeError . new ( obj ) unless obj . is_a? ( Phlex ::SGML )
4949
50+ if layout && stream
51+ raise Phlex ::Sinatra ::ArgumentError . new ( 'streaming is not compatible with layout' )
52+ end
53+
5054 content_type ||= :svg if obj . is_a? ( Phlex ::SVG ) && !layout
5155 self . content_type ( content_type ) if content_type
5256
@@ -55,10 +59,6 @@ def phlex(
5559 layout = @default_layout if layout == true
5660
5761 if stream
58- raise Phlex ::Sinatra ::IncompatibleOptionError . new (
59- 'streaming is not compatible with layout'
60- ) if layout
61-
6262 self . stream do |out |
6363 obj . call ( out , view_context : self )
6464 end
Original file line number Diff line number Diff line change @@ -179,10 +179,10 @@ def app
179179 expect ( last_response . body ) . to start_with ( '<main><pre>' )
180180 end
181181
182- it 'raises an error stream=true' do
182+ it 'raises an error if stream=true' do
183183 expect {
184184 get ( '/stream-with-layout' )
185- } . to raise_error ( Phlex ::Sinatra ::IncompatibleOptionError )
185+ } . to raise_error ( Phlex ::Sinatra ::ArgumentError )
186186 end
187187
188188 it 'works with non-ERB templates' do
You can’t perform that action at this time.
0 commit comments