Class: RSpec::SSE::Matchers::BeGracefullyClosed

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/sse/matchers.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



299
300
301
# File 'lib/rspec/sse/matchers.rb', line 299

def description
  "be gracefully closed"
end

#failure_messageObject



289
290
291
# File 'lib/rspec/sse/matchers.rb', line 289

def failure_message
  'Expected response body to end with "\\n\\n" (SSE graceful close)'
end

#failure_message_when_negatedObject



294
295
296
# File 'lib/rspec/sse/matchers.rb', line 294

def failure_message_when_negated
  'Expected response body not to end with "\\n\\n" (SSE graceful close)'
end

#matches?(actual) ⇒ Boolean

Match if the response body ends with “nn”(SSE graceful close)

Returns:

  • (Boolean)


283
284
285
286
# File 'lib/rspec/sse/matchers.rb', line 283

def matches?(actual)
  @actual = actual
  @actual.body.end_with?("\n\n")
end