Module: JayAPI::RSpec

Defined in:
lib/jay_api/rspec.rb,
lib/jay_api/rspec/git.rb,
lib/jay_api/rspec/configuration.rb,
lib/jay_api/rspec/test_data_collector.rb

Overview

A module that contains the classes and method needed to interact with RSpec data (test cases, test results, etc).

Defined Under Namespace

Modules: Git Classes: TestDataCollector

Class Method Summary collapse

Class Method Details

.configurationJayAPI::Configuration

Returns The current configuration for JayAPI::RSpec.

Returns:

Raises:



13
14
15
16
17
18
19
20
21
# File 'lib/jay_api/rspec/configuration.rb', line 13

def self.configuration
  unless @configuration
    raise JayAPI::Errors::ConfigurationError,
          'No configuration has been set for the JayAPI::RSpec module. ' \
          'Please call JayAPI::RSpec.configure to load/create configuration.'
  end

  @configuration
end

.configure {|Class| ... } ⇒ Object

Called to configure the JayAPI::RSpec module.

Yields:

  • (Class)

    Yields JayAPI::Configuration (the class itself), on it the yielded block can call either, new, from_string or from_file to create the configuration.

Yield Returns:

  • (JayAPI::Configuration)

    The block should return an instance of the JayAPI::Configuration class with the configuration for the module.

Raises:



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/jay_api/rspec/configuration.rb', line 32

def self.configure
  configuration = yield JayAPI::Configuration

  return unless configuration

  unless configuration.is_a?(JayAPI::Configuration)
    raise JayAPI::Errors::ConfigurationError,
          'Expected a JayAPI::Configuration or a subclass. ' \
          "Got a #{configuration.class} instead."
  end

  @configuration = configuration
end