Class: Soaspec::TestServer::IdManager
- Inherits:
-
Object
- Object
- Soaspec::TestServer::IdManager
- Defined in:
- lib/soaspec/test_server/id_manager.rb
Overview
Handles returning ids dependent on a number of factors Made to demonstrate creating testing a list of ids where a few return false when not developed and checking each value in the list can find the false value
Class Attribute Summary collapse
-
.developed ⇒ Object
Returns the value of attribute developed.
Class Method Summary collapse
-
.result_for(num, id) ⇒ Object
Once developed is set, everything will return true.
-
.undeveloped_id(num, id) ⇒ String
Idea is that this will return false for a particular id for different test numbers.
Class Attribute Details
.developed ⇒ Object
Returns the value of attribute developed.
12 13 14 |
# File 'lib/soaspec/test_server/id_manager.rb', line 12 def developed @developed end |
Class Method Details
.result_for(num, id) ⇒ Object
Once developed is set, everything will return true. A ‘false’ value represents something not developed
19 20 21 22 |
# File 'lib/soaspec/test_server/id_manager.rb', line 19 def result_for(num, id) result = undeveloped_id(num, id) unless @developed result || 'true' end |
.undeveloped_id(num, id) ⇒ String
Idea is that this will return false for a particular id for different test numbers
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/soaspec/test_server/id_manager.rb', line 28 def undeveloped_id(num, id) case num when '1', '4', '10' then 'false' if id == '40' when '3', '11', '9' then 'false' if id == '74' when '2', '6', '8' then 'false' if id == '80' when '7', '5', '12' then 'false' if id == '64' else 'true' end end |