File: test_interface.rb

package info (click to toggle)
ruby-dry-configurable 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 184 kB
  • sloc: ruby: 397; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Dry
  module Configurable
    # Methods meant to be used in a testing scenario
    module TestInterface
      # Resets configuration to default values
      #
      # @return [Dry::Configurable::Config]
      #
      # @api public
      def reset_config
        @config = if self.is_a?(Module)
                    _settings.create_config
                  else
                    self.class._settings.create_config
                  end
      end
    end

    # Mixes in test interface into the configurable module
    #
    # @api public
    def enable_test_interface
      extend Dry::Configurable::TestInterface
    end
  end
end