Class: Crucible::Tests::ResourceTest
- Defined in:
- lib/tests/suites/resource_test.rb
Constant Summary
Constants inherited from BaseTest
BaseTest::BASE_SPEC_LINK, BaseTest::JSON_FIELDS, BaseTest::METADATA_FIELDS, BaseTest::REST_SPEC_LINK, BaseTest::STATUS
Instance Attribute Summary collapse
-
#bundle ⇒ Object
Returns the value of attribute bundle.
-
#history_bundle ⇒ Object
Returns the value of attribute history_bundle.
-
#preexisting ⇒ Object
Returns the value of attribute preexisting.
-
#preexisting_id ⇒ Object
Returns the value of attribute preexisting_id.
-
#preexisting_version ⇒ Object
Returns the value of attribute preexisting_version.
-
#resource_class ⇒ Object
Returns the value of attribute resource_class.
-
#temp_id ⇒ Object
Returns the value of attribute temp_id.
-
#temp_resource ⇒ Object
Returns the value of attribute temp_resource.
-
#temp_version ⇒ Object
Returns the value of attribute temp_version.
Attributes inherited from BaseTest
Instance Method Summary collapse
- #category ⇒ Object
- #define_metadata(method) ⇒ Object
- #description ⇒ Object
- #execute(resource_class = nil) ⇒ Object
- #id ⇒ Object
-
#initialize(client1, client2 = nil) ⇒ ResourceTest
constructor
A new instance of ResourceTest.
-
#result_id_suffix ⇒ Object
this allows results to have unique ids for resource based tests.
- #supplement_test_description(desc) ⇒ Object
Methods inherited from BaseSuite
#build_messages, #collect_metadata, #fhir_resources, #links, #metadata, #parse_operation_outcome, #requires, #resource_category, test, #title, #validates
Methods inherited from BaseTest
#author, #details, #execute_test_method, #execute_test_methods, #multiserver, #requires_authorization, #tests, #warning
Methods included from Assertions
#assert, #assert_bundle_entry_count, #assert_bundle_response, #assert_bundle_transactions_okay, #assert_equal, #assert_etag_present, #assert_last_modified_present, #assert_minimum, #assert_navigation_links, #assert_operator, #assert_resource_content_type, #assert_resource_type, #assert_response_bad, #assert_response_code, #assert_response_created, #assert_response_gone, #assert_response_not_found, #assert_response_ok, #assert_valid_content_location_present, #assert_valid_profile, #assert_valid_resource_content_type_present, #assertion_negated, #skip
Constructor Details
#initialize(client1, client2 = nil) ⇒ ResourceTest
Returns a new instance of ResourceTest.
46 47 48 |
# File 'lib/tests/suites/resource_test.rb', line 46 def initialize(client1, client2=nil) super(client1, client2) end |
Instance Attribute Details
#bundle ⇒ Object
Returns the value of attribute bundle.
6 7 8 |
# File 'lib/tests/suites/resource_test.rb', line 6 def bundle @bundle end |
#history_bundle ⇒ Object
Returns the value of attribute history_bundle.
7 8 9 |
# File 'lib/tests/suites/resource_test.rb', line 7 def history_bundle @history_bundle end |
#preexisting ⇒ Object
Returns the value of attribute preexisting.
15 16 17 |
# File 'lib/tests/suites/resource_test.rb', line 15 def preexisting @preexisting end |
#preexisting_id ⇒ Object
Returns the value of attribute preexisting_id.
13 14 15 |
# File 'lib/tests/suites/resource_test.rb', line 13 def preexisting_id @preexisting_id end |
#preexisting_version ⇒ Object
Returns the value of attribute preexisting_version.
14 15 16 |
# File 'lib/tests/suites/resource_test.rb', line 14 def preexisting_version @preexisting_version end |
#resource_class ⇒ Object
Returns the value of attribute resource_class.
5 6 7 |
# File 'lib/tests/suites/resource_test.rb', line 5 def resource_class @resource_class end |
#temp_id ⇒ Object
Returns the value of attribute temp_id.
10 11 12 |
# File 'lib/tests/suites/resource_test.rb', line 10 def temp_id @temp_id end |
#temp_resource ⇒ Object
Returns the value of attribute temp_resource.
9 10 11 |
# File 'lib/tests/suites/resource_test.rb', line 9 def temp_resource @temp_resource end |
#temp_version ⇒ Object
Returns the value of attribute temp_version.
11 12 13 |
# File 'lib/tests/suites/resource_test.rb', line 11 def temp_version @temp_version end |
Instance Method Details
#category ⇒ Object
41 42 43 44 |
# File 'lib/tests/suites/resource_test.rb', line 41 def category resource = @resource_class.nil? ? "Uncategorized" : resource_category(@resource_class.name.demodulize) {id: "resources_#{resource.parameterize}", title: "#{resource} Resources"} end |
#define_metadata(method) ⇒ Object
545 546 547 548 549 |
# File 'lib/tests/suites/resource_test.rb', line 545 def (method) links "#{REST_SPEC_LINK}##{method}" links "#{BASE_SPEC_LINK}/#{resource_class.name.demodulize.downcase}.html" validates resource: resource_class.name.demodulize, methods: [method] end |
#description ⇒ Object
37 38 39 |
# File 'lib/tests/suites/resource_test.rb', line 37 def description "Basic operations for FHIR #{resource_class.name.demodulize} resource (CREATE, READ, VREAD, UPDATE, DELETE, HISTORY, SEARCH, VALIDATE)" end |
#execute(resource_class = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tests/suites/resource_test.rb', line 17 def execute(resource_class=nil) if resource_class @resource_class = resource_class {"ResourceTest_#{@resource_class.name.demodulize}" => execute_test_methods} else results = {} fhir_resources.each do | klass | @resource_class = klass results.merge!({"ResourceTest_#{@resource_class.name.demodulize}" => execute_test_methods}) end results end end |
#id ⇒ Object
31 32 33 34 35 |
# File 'lib/tests/suites/resource_test.rb', line 31 def id suffix = resource_class suffix = resource_class.name.demodulize if !resource_class.nil? "ResourceTest_#{suffix}" end |
#result_id_suffix ⇒ Object
this allows results to have unique ids for resource based tests
51 52 53 |
# File 'lib/tests/suites/resource_test.rb', line 51 def result_id_suffix resource_class.name.demodulize end |
#supplement_test_description(desc) ⇒ Object
55 56 57 |
# File 'lib/tests/suites/resource_test.rb', line 55 def supplement_test_description(desc) "#{resource_class.name.demodulize}: #{desc}" end |