Class: TestCliController
- Inherits:
-
Object
- Object
- TestCliController
- Defined in:
- lib/myer/test_cli_controller.rb
Instance Attribute Summary collapse
-
#out ⇒ Object
Returns the value of attribute out.
Instance Method Summary collapse
- #full(server, pid) ⇒ Object
-
#initialize ⇒ TestCliController
constructor
A new instance of TestCliController.
- #local(executable) ⇒ Object
Constructor Details
#initialize ⇒ TestCliController
Returns a new instance of TestCliController.
4 5 6 |
# File 'lib/myer/test_cli_controller.rb', line 4 def initialize @out = STDOUT end |
Instance Attribute Details
#out ⇒ Object
Returns the value of attribute out.
2 3 4 |
# File 'lib/myer/test_cli_controller.rb', line 2 def out @out end |
Instance Method Details
#full(server, pid) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/myer/test_cli_controller.rb', line 25 def full(server, pid) admin_api = MySelf::Api.new admin_api.server = server admin_api.user, admin_api.password = admin_api.admin_register(pid) token = admin_api.create_token user_api = MySelf::Api.new user_api.server = server user_api.user, user_api.password = admin_api.register(token) bucket = user_api.create_bucket content = "octopus" item = user_api.create_item(bucket, content) items = user_api.get_items(bucket) if items.size == 1 && items[0].id == item && items[0].content == content @out.puts "Full acceptance test passed" else @out.puts "Full acceptance test failed" end end |
#local(executable) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/myer/test_cli_controller.rb', line 8 def local(executable) Dir.mktmpdir do |dir| pin = "xyz" cmd = "#{executable} -pin=#{pin} -logfile=/dev/null #{dir}/data" io = IO.popen(cmd) sleep(1) begin full("localhost", pin) ensure Process.kill("INT", io.pid) end end end |