ts3query 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,19 +6,19 @@ Feature: Run a query command
6
6
  Scenario: Run 'version' command
7
7
  Given I am connected to the default server with the password 0L8awVFD
8
8
  When I run the command version
9
- Then I should get a hash with version=3.0.5 build=1335156372 platform=Linux id=0 msg=ok
9
+ Then I should get a hash with version=3.0.5 build=1335156372 platform=Linux
10
10
 
11
11
  Scenario: Run 'serverlist' command with options
12
12
  Given I am connected to the default server with the password 0L8awVFD
13
13
  When I run the command serverlist with the options -uid -short
14
- Then I should get a hash with virtualserver_id=1 virtualserver_port=9987 virtualserver_status=online id=0 msg=ok
14
+ Then I should get a hash with virtualserver_id=1 virtualserver_port=9987 virtualserver_status=online
15
15
 
16
16
  Scenario: Run 'use' command with parameters
17
17
  Given I am connected to the default server with the password 0L8awVFD
18
18
  When I run the command use with the parameters sid=1
19
- Then I should get a hash with id=0 msg=ok
19
+ Then I should get a hash
20
20
 
21
21
  Scenario: Run 'use' command with options and parameters
22
22
  Given I am connected to the default server with the password 0L8awVFD
23
23
  When I run the command use with the options -virtual and the parameters sid=1
24
- Then I should get a hash with id=0 msg=ok
24
+ Then I should get a hash
@@ -46,10 +46,19 @@ When /^I run the command use with the options (.+) and the parameters (.+)$/ do
46
46
  end
47
47
 
48
48
  Then /^I should get a hash with (.+)$/ do |data|
49
+ list = []
49
50
  hash = {}
51
+
50
52
  data.split(" ").each do |entity|
51
53
  hash[entity.split("=")[0]] = entity.split("=")[1]
52
54
  end
55
+ list << hash
56
+ list << {"id" => "0", "msg" => "ok"}
53
57
 
54
- @result.should eq(hash)
58
+ @result.should eq(list)
55
59
  end
60
+
61
+ Then /^I should get a hash$/ do
62
+ list = [{"id" => "0", "msg" => "ok"}]
63
+ @result.should eq(list)
64
+ end
@@ -8,6 +8,6 @@ rescue Bundler::BundlerError => e
8
8
  end
9
9
 
10
10
  $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
11
- require 'TS3Query'
11
+ require 'ts3query'
12
12
 
13
13
  require 'rspec/expectations'
@@ -10,7 +10,7 @@ class TS3Connection
10
10
  end
11
11
 
12
12
  def method_missing(meth, *args, &block)
13
- result = {}
13
+ result = []
14
14
  options = ""
15
15
  params = ""
16
16
 
@@ -28,11 +28,14 @@ class TS3Connection
28
28
  end
29
29
 
30
30
  @connection.cmd("String" => "#{meth}#{params}#{options}\r",
31
- "Match" => /error id=0 msg=ok\n/) { |data|
31
+ "Match" => /error id=0 msg=ok\n/) { |data|
32
+ current_data = {}
32
33
  data.split(" ").each do |entity|
33
- result[entity.split("=")[0]] = entity.split("=")[1]
34
+ current_data[entity.split("=")[0]] = entity.split("=")[1]
34
35
  end
35
- result.delete("error")
36
+ current_data.delete("error")
37
+
38
+ result << current_data
36
39
  }
37
40
  result
38
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts3query
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: