Class: RSpec::Daemon::Configuration
- Inherits:
-
Object
- Object
- RSpec::Daemon::Configuration
- Defined in:
- lib/rspec/daemon/configuration.rb
Defined Under Namespace
Classes: RecordingProxy
Instance Attribute Summary collapse
-
#config_proxy ⇒ Object
Returns the value of attribute config_proxy.
-
#root_shared_examples ⇒ Object
Returns the value of attribute root_shared_examples.
Instance Method Summary collapse
- #ensure_configuration_setter! ⇒ Object
- #forward_rspec_config_singleton_to(config_proxy) ⇒ Object
- #has_recorded_config? ⇒ Boolean
- #record_configuration(&configuration_block) ⇒ Object
- #replay_configuration ⇒ Object
Instance Attribute Details
#config_proxy ⇒ Object
Returns the value of attribute config_proxy.
4 5 6 |
# File 'lib/rspec/daemon/configuration.rb', line 4 def config_proxy @config_proxy end |
#root_shared_examples ⇒ Object
Returns the value of attribute root_shared_examples.
4 5 6 |
# File 'lib/rspec/daemon/configuration.rb', line 4 def root_shared_examples @root_shared_examples end |
Instance Method Details
#ensure_configuration_setter! ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/rspec/daemon/configuration.rb', line 58 def ensure_configuration_setter! return if RSpec.respond_to?(:configuration=) RSpec.instance_eval do def self.configuration=(value) @configuration = value end end end |
#forward_rspec_config_singleton_to(config_proxy) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/rspec/daemon/configuration.rb', line 51 def forward_rspec_config_singleton_to(config_proxy) # an old version of rspec-rails/lib/rspec/rails/view_rendering.rb adds # methods on the configuration singleton. This takes care of that. RSpec.configuration.singleton_class .send(:define_method, :method_missing, &config_proxy.method(:send)) end |
#has_recorded_config? ⇒ Boolean
47 48 49 |
# File 'lib/rspec/daemon/configuration.rb', line 47 def has_recorded_config? !!self.config_proxy end |
#record_configuration(&configuration_block) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rspec/daemon/configuration.rb', line 19 def record_configuration(&configuration_block) ensure_configuration_setter! original_config = ::RSpec.configuration RSpec.configuration = RecordingProxy.new(original_config, []) configuration_block.call # spec helper is called during this yield, see #reset self.config_proxy = ::RSpec.configuration RSpec.configuration = original_config forward_rspec_config_singleton_to(self.config_proxy) end |
#replay_configuration ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rspec/daemon/configuration.rb', line 33 def replay_configuration RSpec.configure do |config| self.config_proxy..each do |method, args, block| # reporter caches config.output_stream which is not good as it # prevents the runner to use a custom stdout. next if method == :reporter config.send(method, *args, &block) end end forward_rspec_config_singleton_to(self.config_proxy) end |