Class: NoidsClient::IntegrationTest::TestRunner
- Inherits:
-
Object
- Object
- NoidsClient::IntegrationTest::TestRunner
- Defined in:
- lib/noids_client/integration_test.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#connection_class ⇒ Object
readonly
Returns the value of attribute connection_class.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#noids_url ⇒ Object
readonly
Returns the value of attribute noids_url.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ TestRunner
constructor
A new instance of TestRunner.
- #run ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ TestRunner
Returns a new instance of TestRunner.
133 134 135 136 137 138 139 |
# File 'lib/noids_client/integration_test.rb', line 133 def initialize(**kwargs) @logger = kwargs.fetch(:logger) { IntegrationTest.default_logger } logger.debug("logger: #{logger.inspect}") @noids_url = kwargs.fetch(:noids_url) { default_noids_url } @connection_class = kwargs.fetch(:connection_class) { default_connection_class } connect! end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
140 141 142 |
# File 'lib/noids_client/integration_test.rb', line 140 def connection @connection end |
#connection_class ⇒ Object (readonly)
Returns the value of attribute connection_class.
140 141 142 |
# File 'lib/noids_client/integration_test.rb', line 140 def connection_class @connection_class end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
140 141 142 |
# File 'lib/noids_client/integration_test.rb', line 140 def logger @logger end |
#noids_url ⇒ Object (readonly)
Returns the value of attribute noids_url.
140 141 142 |
# File 'lib/noids_client/integration_test.rb', line 140 def noids_url @noids_url end |
Instance Method Details
#run ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/noids_client/integration_test.rb', line 168 def run assert(connection.pool_list.empty?, "Expected connection.pool_list to be empty") new_pool = connection.new_pool("test", ".sddd") assert(new_pool, "Expected to be able to create a pool") assert(connection.pool_list.include?("test"), "Expected connection.pool_list to include test") pool = connection.get_pool("test") assert(pool.name == "test", "Expected pool to be named 'test'") assert(pool.ids_used == 0, "Expected pool to have no used IDs") ids = pool.mint(2) assert(ids.size == 2, "Expected to mint 2 ids with `pool.mint(2)`") assert(pool.close, "Expected close to be successful") assert(pool.open, "Expected to be able to re-open the pool") assert(pool.ids_used == 2, "Expected the previously minted ids to register as used") return true end |