diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8994d0e..3869693 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,4 +63,6 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Run tests - run: bundle exec rspec ./spec/* + run: bundle exec rake spec + env: + ZABBIX_RUN_ACCEPTANCE: true diff --git a/spec/action.rb b/spec/acceptance/action_spec.rb similarity index 100% rename from spec/action.rb rename to spec/acceptance/action_spec.rb diff --git a/spec/application.rb b/spec/acceptance/application_spec.rb similarity index 100% rename from spec/application.rb rename to spec/acceptance/application_spec.rb diff --git a/spec/basic_func.rb b/spec/acceptance/basic_func_spec.rb similarity index 100% rename from spec/basic_func.rb rename to spec/acceptance/basic_func_spec.rb diff --git a/spec/configuration.rb b/spec/acceptance/configuration_spec.rb similarity index 100% rename from spec/configuration.rb rename to spec/acceptance/configuration_spec.rb diff --git a/spec/drule.rb b/spec/acceptance/drule_spec.rb similarity index 100% rename from spec/drule.rb rename to spec/acceptance/drule_spec.rb diff --git a/spec/event.rb b/spec/acceptance/event_spec.rb similarity index 100% rename from spec/event.rb rename to spec/acceptance/event_spec.rb diff --git a/spec/graph.rb b/spec/acceptance/graph_spec.rb similarity index 100% rename from spec/graph.rb rename to spec/acceptance/graph_spec.rb diff --git a/spec/host.rb b/spec/acceptance/host_spec.rb similarity index 100% rename from spec/host.rb rename to spec/acceptance/host_spec.rb diff --git a/spec/hostgroup.rb b/spec/acceptance/hostgroup_spec.rb similarity index 100% rename from spec/hostgroup.rb rename to spec/acceptance/hostgroup_spec.rb diff --git a/spec/httptest.rb b/spec/acceptance/httptest_spec.rb similarity index 100% rename from spec/httptest.rb rename to spec/acceptance/httptest_spec.rb diff --git a/spec/item.rb b/spec/acceptance/item_spec.rb similarity index 100% rename from spec/item.rb rename to spec/acceptance/item_spec.rb diff --git a/spec/maintenance.rb b/spec/acceptance/maintenance_spec.rb similarity index 100% rename from spec/maintenance.rb rename to spec/acceptance/maintenance_spec.rb diff --git a/spec/mediatype.rb b/spec/acceptance/mediatype_spec.rb similarity index 100% rename from spec/mediatype.rb rename to spec/acceptance/mediatype_spec.rb diff --git a/spec/problem.rb b/spec/acceptance/problem_spec.rb similarity index 100% rename from spec/problem.rb rename to spec/acceptance/problem_spec.rb diff --git a/spec/query.rb b/spec/acceptance/query_spec.rb similarity index 100% rename from spec/query.rb rename to spec/acceptance/query_spec.rb diff --git a/spec/screen.rb b/spec/acceptance/screen_spec.rb similarity index 100% rename from spec/screen.rb rename to spec/acceptance/screen_spec.rb diff --git a/spec/script.rb b/spec/acceptance/script_spec.rb similarity index 100% rename from spec/script.rb rename to spec/acceptance/script_spec.rb diff --git a/spec/server.rb b/spec/acceptance/server_spec.rb similarity index 100% rename from spec/server.rb rename to spec/acceptance/server_spec.rb diff --git a/spec/template.rb b/spec/acceptance/template_spec.rb similarity index 100% rename from spec/template.rb rename to spec/acceptance/template_spec.rb diff --git a/spec/trigger.rb b/spec/acceptance/trigger_spec.rb similarity index 100% rename from spec/trigger.rb rename to spec/acceptance/trigger_spec.rb diff --git a/spec/user.rb b/spec/acceptance/user_spec.rb similarity index 100% rename from spec/user.rb rename to spec/acceptance/user_spec.rb diff --git a/spec/usergroup.rb b/spec/acceptance/usergroup_spec.rb similarity index 100% rename from spec/usergroup.rb rename to spec/acceptance/usergroup_spec.rb diff --git a/spec/usermacro.rb b/spec/acceptance/usermacro_spec.rb similarity index 100% rename from spec/usermacro.rb rename to spec/acceptance/usermacro_spec.rb diff --git a/spec/valuemap.rb b/spec/acceptance/valuemap_spec.rb similarity index 100% rename from spec/valuemap.rb rename to spec/acceptance/valuemap_spec.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8bcd1c0..91fd51e 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,16 @@ require 'zabbixapi' +RSpec.configure do |config| + config.define_derived_metadata(file_path: %r{/spec/acceptance/}) do |metadata| + metadata[:type] = :acceptance + end + + # Don't run acceptance tests unless a host is provided + unless (ENV.key?('ZABBIX_HOST_URL') || ENV.key?('ZABBIX_RUN_ACCEPTANCE')) + config.filter_run_excluding type: :acceptance + end +end + def zbx # settings @api_url = ENV['ZABBIX_HOST_URL'] || 'http://localhost:8080/api_jsonrpc.php'