Module: Gruf::Rspec::Configuration
- Included in:
- Gruf::Rspec
- Defined in:
- lib/gruf/rspec/configuration.rb
Overview
Represents configuration settings for the system
Constant Summary collapse
- DEFAULT_RSPEC_PATH =
'/spec/rpc/'
- VALID_CONFIG_KEYS =
{ authentication_hydrators: { base: Gruf::Rspec::AuthenticationHydrators::Base, basic: Gruf::Rspec::AuthenticationHydrators::Basic }, rpc_spec_path: ENV.fetch('RPC_SPEC_PATH', DEFAULT_RSPEC_PATH).to_s }.freeze
Class Method Summary collapse
-
.extended(base) ⇒ Object
Whenever this is extended into a class, setup the defaults.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Gruf::Rspec::Configuration
Yield self for ruby-style initialization.
-
#options ⇒ Hash
Return the current configuration options as a Hash.
-
#reset ⇒ Hash
Set the default configuration onto the extended class.
Class Method Details
.extended(base) ⇒ Object
Whenever this is extended into a class, setup the defaults
39 40 41 |
# File 'lib/gruf/rspec/configuration.rb', line 39 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Gruf::Rspec::Configuration
Yield self for ruby-style initialization
49 50 51 |
# File 'lib/gruf/rspec/configuration.rb', line 49 def configure yield self end |
#options ⇒ Hash
Return the current configuration options as a Hash
58 59 60 61 62 63 64 |
# File 'lib/gruf/rspec/configuration.rb', line 58 def opts = {} VALID_CONFIG_KEYS.each_key do |k| opts.merge!(k => send(k)) end opts end |
#reset ⇒ Hash
Set the default configuration onto the extended class
71 72 73 74 75 76 77 |
# File 'lib/gruf/rspec/configuration.rb', line 71 def reset VALID_CONFIG_KEYS.each do |k, v| send("#{k}=", v) end self.rpc_spec_path = ::ENV.fetch('RPC_SPEC_PATH', DEFAULT_RSPEC_PATH).to_s end |