spec/support/integration_helper.rb in rubix-0.3.1 vs spec/support/integration_helper.rb in rubix-0.4.0
- old
+ new
@@ -1,10 +1,14 @@
module Rubix
module IntegrationHelper
-
+
def integration_test
- pending("A live Zabbix API to test against") unless $RUBIX_INTEGRATION_TEST
+ if $RUBIX_INTEGRATION_TEST
+ Rubix.connect($RUBIX_INTEGRATION_TEST['url'], $RUBIX_INTEGRATION_TEST['username'], $RUBIX_INTEGRATION_TEST['password'])
+ else
+ pending("A live Zabbix API to test against")
+ end
end
def ensure_save(obj)
begin
raise Rubix::Error.new(Rubix.connection.last_response.error_message) unless obj.save
@@ -59,10 +63,10 @@
require 'mysql2'
$RUBIX_MYSQL_CLIENT = Mysql2::Client.new(:host => mysql_connection['host'], :username => mysql_connection['username'], :password => mysql_connection['password'], :database => mysql_connection['database'])
truncate_all_tables
- $RUBIX_INTEGRATION_TEST = true
+ $RUBIX_INTEGRATION_TEST = api_connection
end
RUBIX_TABLES_TO_TRUNCATE = %w[applications groups hostmacro hosts hosts_groups hosts_profiles hosts_profiles_ext hosts_templates items items_applications profiles triggers trigger_depends]
def self.truncate_all_tables