Skip to content

Commit

Permalink
Better skip
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Sep 4, 2024
1 parent 1d893de commit 360e348
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
RUBYGEMS_VERSION: ${{ matrix.rubygems.version }}
# Fail hard when Toxiproxy is not running to ensure all tests (even Toxiproxy optional ones) are passing
REQUIRE_TOXIPROXY: true
REQUIRE_AVO_PRO: true
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Avo::GemNameReservationsControllerTest < ActionDispatch::IntegrationTest
end

test "resource search_query scope" do
skip "avo-pro needed to run this test" unless defined?(Avo::Pro)
requires_avo_pro

admin_sign_in_as create(:admin_github_user, :is_admin)
create(:gem_name_reservation, name: "hello")
Expand Down
12 changes: 11 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ def requires_toxiproxy
skip("Toxiproxy is not running, but was required for this test.")
end

def requires_avo_pro
return if Avo.configuration.license == "advanced" && defined?(Avo::Pro)

if ENV["REQUIRE_AVO_PRO"]
raise "REQUIRE_AVO_PRO is set but Avo::Pro is missing in #{Rails.env}." \
"\nRAILS_GROUPS=#{ENV['RAILS_GROUPS'].inspect}\nAvo.license=#{Avo.license.inspect}"
end
skip "avo pro is not present but was required for this test"
end

def assert_changed(object, *attributes)
original_attributes = attributes.index_with { |a| object.send(a) }
yield if block_given?
Expand Down Expand Up @@ -242,7 +252,7 @@ class SystemTest < ActionDispatch::IntegrationTest

class AdminPolicyTestCase < ActiveSupport::TestCase
def setup
skip "avo-pro needed to run this test" unless defined?(Avo::Pro)
requires_avo_pro

@authorization_client = Admin::AuthorizationClient.new
end
Expand Down

0 comments on commit 360e348

Please sign in to comment.