Sha256: 421c9849179e9b2e31ff76c2cfeb87c08f4a869e19195ab34024438566a92095

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "vault/rails"

require "rspec"

def vault_version_string
  @vault_version_string ||= `vault --version`
end

TEST_VAULT_VERSION = Gem::Version.new(vault_version_string.match(/(\d+\.\d+\.\d+)/)[1])

RSpec.configure do |config|
  # Prohibit using the should syntax
  config.expect_with :rspec do |spec|
    spec.syntax = :expect
  end

  # Allow tests to isolate a specific test using +focus: true+. If nothing
  # is focused, then all tests are executed.
  config.filter_run_when_matching :focus
  config.filter_run_excluding vault: lambda { |v|
    !vault_meets_requirements?(v)
  }
  config.filter_run_excluding ent_vault: lambda { |v|
    !vault_is_enterprise? || !vault_meets_requirements?(v)
  }
  config.filter_run_excluding non_ent_vault: lambda { |v|
    vault_is_enterprise? || !vault_meets_requirements?(v)
  }

  # Allow tests to isolate a specific test using +focus: true+. If nothing
  # is focused, then all tests are executed.
  config.filter_run(focus: true)
  config.run_all_when_everything_filtered = true

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = 'random'
end

def vault_is_enterprise?
  !!vault_version_string.match(/\+(?:ent|prem)/)
end

def vault_meets_requirements?(v)
  Gem::Requirement.new(v).satisfied_by?(TEST_VAULT_VERSION)
end

require File.expand_path("../dummy/config/environment.rb", __FILE__)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vault-rails-0.8.0 spec/spec_helper.rb
vault-rails-0.7.1 spec/spec_helper.rb
vault-rails-0.7.0 spec/spec_helper.rb