Class: DeleteCommand
- Inherits:
-
Object
- Object
- DeleteCommand
- Defined in:
- lib/brine/cleaner_upper.rb
Overview
cleaner_upper.rb – clean up resources created during test run
Will issue DELETE call for all tracked URLs which will normally be triggered in a hook.
The present approach for this is to explicitly track created resources to which DELETE calls will be sent. Cleaning up of resources will be given some further attention in the future, but this functionality should be preserved.
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(client, path, oks: [200,204], attempts: 3) ⇒ DeleteCommand
constructor
A new instance of DeleteCommand.
Constructor Details
#initialize(client, path, oks: [200,204], attempts: 3) ⇒ DeleteCommand
Returns a new instance of DeleteCommand.
12 13 14 15 16 17 18 19 |
# File 'lib/brine/cleaner_upper.rb', line 12 def initialize(client, path, oks:[200,204], attempts: 3) @client = client @path = path @oks = oks @attempts = attempts end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/brine/cleaner_upper.rb', line 10 def client @client end |
#path ⇒ Object
Returns the value of attribute path.
10 11 12 |
# File 'lib/brine/cleaner_upper.rb', line 10 def path @path end |
Instance Method Details
#cleanup ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/brine/cleaner_upper.rb', line 21 def cleanup while @attempts > 0 begin resp=@client.delete(@path) return true if @oks.include?(resp.status) rescue ex puts "WARNING: #{ex}" end @attempts -= 1 end puts "ERROR: Could not DELETE #{@path}" false end |