Class: RSpec::JsonApi::Matchers::HaveNoContent
- Inherits:
-
Object
- Object
- RSpec::JsonApi::Matchers::HaveNoContent
- Defined in:
- lib/rspec/json_api/matchers/have_no_content.rb
Overview
The HaveNoContent class is designed to verify that a given string is empty.
This matcher is primarily used within RSpec tests to assert that a given string lacks content, effectively ensuring that expected content is absent, which can be particularly useful in testing API responses or other outputs where the absence of content signifies a specific state or outcome.
Instance Method Summary collapse
-
#failure_message ⇒ String
Provides a failure message for when the actual string contains content, contrary to the expectation of being empty.
-
#failure_message_when_negated ⇒ String
Provides a failure message for when the expectation is negated (i.e., expecting content) and the actual string is unexpectedly empty.
-
#matches?(actual) ⇒ Boolean
Determines whether the actual string is empty, signifying no content.
Instance Method Details
#failure_message ⇒ String
Provides a failure message for when the actual string contains content, contrary to the expectation of being empty.
26 27 28 |
# File 'lib/rspec/json_api/matchers/have_no_content.rb', line 26 def "expected the string to be empty but it contained content" end |
#failure_message_when_negated ⇒ String
Provides a failure message for when the expectation is negated (i.e., expecting content) and the actual string is unexpectedly empty.
35 36 37 |
# File 'lib/rspec/json_api/matchers/have_no_content.rb', line 35 def "expected the string not to be empty, yet it was devoid of content" end |
#matches?(actual) ⇒ Boolean
Determines whether the actual string is empty, signifying no content.
17 18 19 |
# File 'lib/rspec/json_api/matchers/have_no_content.rb', line 17 def matches?(actual) actual == "" end |