Guest User

Untitled

a guest
Apr 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. require 'asgard' # Or whatever the file is called
  2.  
  3. class TestBackend
  4. def initialize(*)
  5. @stack = []
  6. @closed = false
  7. end
  8.  
  9. def run
  10. until @closed
  11. sleep 0.05
  12. end
  13. end
  14.  
  15. def stack
  16. @stack.slice!(0..-1)
  17. end
  18.  
  19. def push(line)
  20. @stack << line
  21. end
  22.  
  23. def close
  24. @closed = true # Stops the running thread
  25. end
  26. end
  27.  
  28. describe BackendMaster do
  29. it "should initialize without error" do
  30. lambda { BackendMaster.new }.should_not raise_error
  31. end
  32.  
  33. it "should accept a backend with the run_backend method" do
  34. backend = TestBackend.new
  35. bm = BackendMaster.new
  36. bm.run_backend(backend)
  37. bm.backends.should include(backend)
  38. end
  39. end
Add Comment
Please, Sign In to add comment