Class: FakeSQS::TestIntegration
- Inherits:
-
Object
- Object
- FakeSQS::TestIntegration
- Defined in:
- lib/fake_sqs/test_integration.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #expire ⇒ Object
- #host ⇒ Object
-
#initialize(options = {}) ⇒ TestIntegration
constructor
A new instance of TestIntegration.
- #port ⇒ Object
- #reset ⇒ Object
- #start ⇒ Object
- #start! ⇒ Object
- #stop ⇒ Object
- #up? ⇒ Boolean
- #uri ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ TestIntegration
Returns a new instance of TestIntegration.
8 9 10 |
# File 'lib/fake_sqs/test_integration.rb', line 8 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/fake_sqs/test_integration.rb', line 6 def @options end |
Instance Method Details
#expire ⇒ Object
45 46 47 |
# File 'lib/fake_sqs/test_integration.rb', line 45 def expire connection.put("/", "") end |
#host ⇒ Object
12 13 14 |
# File 'lib/fake_sqs/test_integration.rb', line 12 def host option :sqs_endpoint end |
#port ⇒ Object
16 17 18 |
# File 'lib/fake_sqs/test_integration.rb', line 16 def port option :sqs_port end |
#reset ⇒ Object
41 42 43 |
# File 'lib/fake_sqs/test_integration.rb', line 41 def reset connection.delete("/") end |
#start ⇒ Object
20 21 22 23 |
# File 'lib/fake_sqs/test_integration.rb', line 20 def start start! unless up? reset end |
#start! ⇒ Object
25 26 27 28 29 |
# File 'lib/fake_sqs/test_integration.rb', line 25 def start! args = [ binfile, "-p", port.to_s, verbose, logging, "--database", database, { :out => out, :err => out } ].flatten.compact @pid = Process.spawn(*args) wait_until_up end |
#stop ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/fake_sqs/test_integration.rb', line 31 def stop if @pid Process.kill("INT", @pid) Process.waitpid(@pid) @pid = nil else $stderr.puts "FakeSQS is not running" end end |
#up? ⇒ Boolean
57 58 59 60 61 |
# File 'lib/fake_sqs/test_integration.rb', line 57 def up? @pid && connection.get("/").code.to_s == "200" rescue Errno::ECONNREFUSED false end |
#uri ⇒ Object
53 54 55 |
# File 'lib/fake_sqs/test_integration.rb', line 53 def uri URI(url) end |
#url ⇒ Object
49 50 51 |
# File 'lib/fake_sqs/test_integration.rb', line 49 def url "http://#{host}:#{port}" end |