Module: APIMatchers::RSpecMatchers
- Defined in:
- lib/api_matchers/core/rspec_matchers.rb
Instance Method Summary collapse
- #be_bad_request ⇒ Object (also: #be_a_bad_request)
- #be_internal_server_error ⇒ Object (also: #be_an_internal_server_error)
- #be_json ⇒ Object (also: #be_in_json, #be_a_json)
- #be_not_found ⇒ Object
- #be_ok ⇒ Object
- #be_unauthorized ⇒ Object
- #be_unprocessable_entity ⇒ Object
- #be_xml ⇒ Object (also: #be_in_xml)
- #create_resource ⇒ Object (also: #created_resource)
- #have_json(expected_json) ⇒ Object
- #have_json_node(expected_node) ⇒ Object
- #have_node(expected_node) ⇒ Object
- #have_xml_node(expected_node) ⇒ Object
Instance Method Details
#be_bad_request ⇒ Object Also known as: be_a_bad_request
3 4 5 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 3 def be_bad_request ::APIMatchers::HTTPStatusCode::BeBadRequest.new(::APIMatchers::Core::Setup) end |
#be_internal_server_error ⇒ Object Also known as: be_an_internal_server_error
12 13 14 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 12 def be_internal_server_error ::APIMatchers::HTTPStatusCode::BeInternalServerError.new(::APIMatchers::Core::Setup) end |
#be_json ⇒ Object Also known as: be_in_json, be_a_json
39 40 41 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 39 def be_json ::APIMatchers::Headers::BeJSON.new(::APIMatchers::Core::Setup) end |
#be_not_found ⇒ Object
8 9 10 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 8 def be_not_found ::APIMatchers::HTTPStatusCode::BeNotFound.new(::APIMatchers::Core::Setup) end |
#be_ok ⇒ Object
21 22 23 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 21 def be_ok ::APIMatchers::HTTPStatusCode::BeOk.new(::APIMatchers::Core::Setup) end |
#be_unauthorized ⇒ Object
17 18 19 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 17 def ::APIMatchers::HTTPStatusCode::BeUnauthorized.new(::APIMatchers::Core::Setup) end |
#be_unprocessable_entity ⇒ Object
25 26 27 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 25 def be_unprocessable_entity ::APIMatchers::HTTPStatusCode::BeUnprocessableEntity.new(::APIMatchers::Core::Setup) end |
#be_xml ⇒ Object Also known as: be_in_xml
34 35 36 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 34 def be_xml ::APIMatchers::Headers::BeXML.new(::APIMatchers::Core::Setup) end |
#create_resource ⇒ Object Also known as: created_resource
29 30 31 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 29 def create_resource ::APIMatchers::HTTPStatusCode::CreateResource.new(::APIMatchers::Core::Setup) end |
#have_json(expected_json) ⇒ Object
53 54 55 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 53 def have_json(expected_json) ::APIMatchers::ResponseBody::HaveJson.new(expected_json) end |
#have_json_node(expected_node) ⇒ Object
45 46 47 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 45 def have_json_node(expected_node) ::APIMatchers::ResponseBody::HaveJsonNode.new(expected_node: expected_node, setup: ::APIMatchers::Core::Setup) end |
#have_node(expected_node) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 57 def have_node(expected_node) if ::APIMatchers::Core::Setup.have_node_matcher.equal?(:json) have_json_node(expected_node) else have_xml_node(expected_node) end end |
#have_xml_node(expected_node) ⇒ Object
49 50 51 |
# File 'lib/api_matchers/core/rspec_matchers.rb', line 49 def have_xml_node(expected_node) ::APIMatchers::ResponseBody::HaveXmlNode.new(expected_node: expected_node, setup: ::APIMatchers::Core::Setup) end |