class Shoulda::Matchers::Integrations::Configuration
@private
def self.apply(&block)
def self.apply(&block) new(&block).apply end
def apply
def apply if no_test_frameworks_added? && no_libraries_added? raise ConfigurationError, <<EOT matchers is not configured correctly. You need to specify at least one mework and/or library. For example: :Matchers.configure do |config| .integrate do |with| .test_framework :rspec .library :rails end @test_frameworks.each do |test_framework| test_framework.include(Shoulda::Matchers::Independent) @libraries.each { |library| library.integrate_with(test_framework) } end self end
def clear_default_test_framework
def clear_default_test_framework @test_frameworks.select!(&:present?) end
def initialize(&block)
def initialize(&block) @test_frameworks = Set.new @libraries = Set.new test_framework :missing_test_framework library :missing_library block.call(self) end
def library(name)
def library(name) @libraries << Integrations.find_library!(name) end
def no_libraries_added?
def no_libraries_added? @libraries.empty? end
def no_test_frameworks_added?
def no_test_frameworks_added? @test_frameworks.empty? || !@test_frameworks.any?(&:present?) end
def test_framework(name)
def test_framework(name) clear_default_test_framework @test_frameworks << Integrations.find_test_framework!(name) end